-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
33 lines (24 loc) · 690 Bytes
/
Dockerfile
File metadata and controls
33 lines (24 loc) · 690 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
FROM rust:1.85-alpine AS builder
WORKDIR /app
# Cache dependencies
COPY Cargo.toml Cargo.lock* ./
COPY src ./src
RUN cargo build --release --bin my_telegram_bot
FROM alpine:3.21
# Install runtime dependencies (yt-dlp, bc, ffmpeg)
RUN apk add --no-cache \
ca-certificates \
ffmpeg \
bc \
python3 \
py3-pip \
&& python3 -m venv /venv \
&& /venv/bin/pip install --no-cache-dir yt-dlp \
&& ln -s /venv/bin/yt-dlp /usr/local/bin/yt-dlp
# Copy the compiled binary
COPY --from=builder /app/target/release/my_telegram_bot /usr/local/bin/my_telegram_bot
# Run as non-root user
RUN adduser -D -u 1001 botuser
USER botuser
WORKDIR /app
CMD ["my_telegram_bot"]