feat: dockerize

This commit is contained in:
Kristofers Solo 2025-09-19 20:05:24 +03:00
parent a7e5d43423
commit 36270c7a3f
Signed by: kristoferssolo
GPG Key ID: 8687F2D3EEE6F0ED
3 changed files with 51 additions and 0 deletions

6
.dockerignore Normal file
View File

@ -0,0 +1,6 @@
.env
target/
tests/
Dockerfile
README.md
LICENSE

31
Dockerfile Normal file
View 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
View 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