mirror of
https://github.com/kristoferssolo/tg-relay-rs.git
synced 2025-12-20 11:04:41 +00:00
feat: dockerize
This commit is contained in:
parent
a7e5d43423
commit
36270c7a3f
6
.dockerignore
Normal file
6
.dockerignore
Normal file
@ -0,0 +1,6 @@
|
||||
.env
|
||||
target/
|
||||
tests/
|
||||
Dockerfile
|
||||
README.md
|
||||
LICENSE
|
||||
31
Dockerfile
Normal file
31
Dockerfile
Normal file
@ -0,0 +1,31 @@
|
||||
FROM rust:1.90-slim-trixie as builder
|
||||
WORKDIR /app
|
||||
|
||||
COPY Cargo.toml Cargo.lock ./
|
||||
COPY . .
|
||||
|
||||
RUN apt-get update -y \
|
||||
&& apt-get install -y --no-install-recommends \
|
||||
pkg-config libssl-dev ca-certificates \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
RUN cargo build --release
|
||||
|
||||
FROM python:3-slim AS runtime
|
||||
FROM python:3.12-slim-trixie
|
||||
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
|
||||
|
||||
ENV TZ=UTC
|
||||
ENV RUST_LOG=info
|
||||
ENV PATH=/home/app/.local/bin:$PATH
|
||||
|
||||
RUN useradd --create-home --shell /bin/bash app
|
||||
WORKDIR /home/app
|
||||
USER app
|
||||
|
||||
RUN uv tool install instaloader \
|
||||
&& instaloader --version
|
||||
|
||||
COPY --from=builder /app/target/release/tg-relay-rs /usr/local/bin/tg-relay-rs
|
||||
|
||||
CMD ["/usr/local/bin/tg-relay-rs"]
|
||||
14
docker-compose.yml
Normal file
14
docker-compose.yml
Normal file
@ -0,0 +1,14 @@
|
||||
services:
|
||||
bot:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile
|
||||
args:
|
||||
BINARY_NAME: tg-relay-rs
|
||||
environment:
|
||||
TELOXIDE_TOKEN: ${TELOXIDE_TOKEN}
|
||||
RUST_LOG: ${RUST_LOG:-info}
|
||||
restart: unless-stopped
|
||||
# If you need persistent storage (e.g. caching):
|
||||
volumes:
|
||||
- ./data:/app/data
|
||||
Loading…
Reference in New Issue
Block a user