Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 12 additions & 5 deletions telegram-bot/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,23 @@ RUN --mount=type=cache,target=/go/pkg/mod \
RUN mkdir -p /tmp/tts && chmod 777 /tmp/tts

# Production stage
FROM scratch
FROM alpine:latest

# Copy ca-certificates from builder for HTTPS requests
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/

# Copy timezone data
COPY --from=builder /usr/share/zoneinfo /usr/share/zoneinfo

# Copy /tmp/tts directory from builder
COPY --from=builder /tmp/tts /tmp/tts
# Copy /tmp/tts directory from builder (optional, but we'll recreate it anyway)
# COPY --from=builder /tmp/tts /tmp/tts

# Create non-root user for security
USER 1000:1000
# Create non-root user for security (ensure it exists in alpine)
RUN adduser -D -u 1000 appuser

# Ensure /tmp/tts exists and is writable by the app user
USER root
RUN mkdir -p /tmp/tts && chmod 777 /tmp/tts && chown appuser:appuser /tmp/tts

# Copy binary from builder
COPY --from=builder /app/fluently_bot /fluently_bot
Expand All @@ -54,6 +58,9 @@ WORKDIR /
# Expose port if needed (adjust as per your application)
EXPOSE 8080

# Switch to non-root user
USER appuser

# Health check
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
CMD ["/fluently_bot", "--health-check"] || exit 1
Expand Down