Some checks are pending
Backend CI / test (push) Waiting to run
Backend CI / build (push) Blocked by required conditions
Deploy Mnemo Cards / Deploy Backend (push) Waiting to run
Deploy Mnemo Cards / Deploy Web App (push) Blocked by required conditions
Deploy Mnemo Cards / Final Verification (push) Blocked by required conditions
Deploy Telegram Bot / Deploy Telegram Bot (push) Waiting to run
64 lines
1.8 KiB
Docker
64 lines
1.8 KiB
Docker
# syntax=docker/dockerfile:1.7
|
|
|
|
# --- Build stage ------------------------------------------------------------
|
|
# Note: This Dockerfile should be built from the parent directory:
|
|
# docker build -f mnemo_cards_telegram_bot/Dockerfile -t mnemo_cards_telegram_bot .
|
|
|
|
FROM dart:stable-sdk AS build
|
|
WORKDIR /app
|
|
|
|
# Copy all local dependencies
|
|
COPY mnemo_cards_common /app/mnemo_cards_common
|
|
COPY mnemo_cards_common_backend /app/mnemo_cards_common_backend
|
|
COPY mnemo_cards_telegram_bot /app/mnemo_cards_telegram_bot
|
|
|
|
# Get dependencies (order matters due to path dependencies)
|
|
WORKDIR /app/mnemo_cards_common
|
|
RUN dart pub get
|
|
|
|
WORKDIR /app/mnemo_cards_common_backend
|
|
RUN dart pub get
|
|
|
|
WORKDIR /app/mnemo_cards_telegram_bot
|
|
RUN dart pub get
|
|
|
|
# Compile to native executable
|
|
RUN dart compile exe bin/main.dart -o /app/bot
|
|
|
|
# --- Runtime stage ----------------------------------------------------------
|
|
FROM debian:bookworm-slim AS runtime
|
|
WORKDIR /app
|
|
|
|
# Install runtime dependencies
|
|
RUN apt-get update \
|
|
&& apt-get install -y --no-install-recommends \
|
|
ca-certificates \
|
|
curl \
|
|
zip \
|
|
procps \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
# Copy bot binary
|
|
COPY --from=build /app/bot /app/bot
|
|
|
|
# Copy required files
|
|
COPY --from=build /app/mnemo_cards_telegram_bot/admins /app/admins
|
|
|
|
# Create required directories
|
|
RUN mkdir -p /app/backups /app/zips /app/apks && \
|
|
chmod -R 755 /app/backups /app/zips /app/apks
|
|
|
|
# Environment variables
|
|
ENV BACKEND_URL=https://api.mnemo-cards.online \
|
|
BOT_SHARE_DAILY_LIMIT=1 \
|
|
TELEGRAM_BOT_API_KEY= \
|
|
TELEGRAM_BOT_TOKEN=
|
|
|
|
# No EXPOSE needed - bot uses outbound connections only (polling)
|
|
|
|
# Healthcheck - check if process is running
|
|
HEALTHCHECK --interval=30s --timeout=5s --retries=3 --start-period=10s \
|
|
CMD pgrep -f "/app/bot" > /dev/null || exit 1
|
|
|
|
# Start bot
|
|
CMD ["/app/bot"]
|