mnemo_cards/mnemo_cards_backend/Dockerfile

49 lines
1.2 KiB
Docker
Raw Normal View History

2025-12-10 23:13:33 +00:00
# syntax=docker/dockerfile:1.7
# --- Build stage ------------------------------------------------------------
FROM dart:stable-sdk AS build
WORKDIR /app
# Cache dependencies
COPY pubspec.* ./
RUN dart pub get
# Copy sources
COPY . .
# Compile to native executable
RUN dart compile exe lib/main.dart -o /app/server
# --- Runtime stage ----------------------------------------------------------
FROM debian:bookworm-slim AS runtime
WORKDIR /app
RUN apt-get update \
&& apt-get install -y --no-install-recommends ca-certificates openssl curl \
&& rm -rf /var/lib/apt/lists/*
# App binary
COPY --from=build /app/server /app/server
# Static/assets needed at runtime (adjust as required)
COPY public /app/public
COPY data /app/data
# Writable dirs for isar/backups by default
RUN mkdir -p /app/isar /app/backups
ENV PORT=8081 \
ADDRESS=0.0.0.0 \
ISAR_DIR=/app/isar \
BACKUP_DIR=/app/backups \
WORKDIR=/app
EXPOSE 8081
# Healthcheck (tune path if different)
HEALTHCHECK --interval=15s --timeout=5s --start-period=10s --retries=5 \
CMD curl -f http://127.0.0.1:${PORT}/health || exit 1
CMD ["/app/server", "-a", "0.0.0.0", "-p", "8081", "--isar", "/app/isar", "--backup", "/app/backups", "--workdir", "/app"]