docker
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
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
This commit is contained in:
parent
9bd45b9064
commit
f9207e6d0c
1 changed files with 24 additions and 12 deletions
|
|
@ -1,15 +1,26 @@
|
||||||
# syntax=docker/dockerfile:1.7
|
# syntax=docker/dockerfile:1.7
|
||||||
|
|
||||||
# --- Build stage ------------------------------------------------------------
|
# --- Build stage ------------------------------------------------------------
|
||||||
|
# Note: This Dockerfile should be built from the parent directory:
|
||||||
|
# docker build -f mnemo_cards_backend/Dockerfile -t mnemo_cards_backend .
|
||||||
|
|
||||||
FROM dart:stable-sdk AS build
|
FROM dart:stable-sdk AS build
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
# Cache dependencies
|
# Copy all sources at once (simpler and more efficient)
|
||||||
COPY pubspec.* ./
|
COPY mnemo_cards_common /app/mnemo_cards_common
|
||||||
|
COPY mnemo_cards_common_backend /app/mnemo_cards_common_backend
|
||||||
|
COPY mnemo_cards_backend /app/mnemo_cards_backend
|
||||||
|
|
||||||
|
# Get dependencies (path dependencies will resolve correctly)
|
||||||
|
WORKDIR /app/mnemo_cards_common
|
||||||
RUN dart pub get
|
RUN dart pub get
|
||||||
|
|
||||||
# Copy sources
|
WORKDIR /app/mnemo_cards_common_backend
|
||||||
COPY . .
|
RUN dart pub get
|
||||||
|
|
||||||
|
WORKDIR /app/mnemo_cards_backend
|
||||||
|
RUN dart pub get
|
||||||
|
|
||||||
# Compile to native executable
|
# Compile to native executable
|
||||||
RUN dart compile exe lib/main.dart -o /app/server
|
RUN dart compile exe lib/main.dart -o /app/server
|
||||||
|
|
@ -25,24 +36,25 @@ RUN apt-get update \
|
||||||
# App binary
|
# App binary
|
||||||
COPY --from=build /app/server /app/server
|
COPY --from=build /app/server /app/server
|
||||||
|
|
||||||
# Static/assets needed at runtime (adjust as required)
|
# Static/assets needed at runtime
|
||||||
# COPY public /app/public
|
COPY --from=build /app/mnemo_cards_backend/public /app/public
|
||||||
# COPY data /app/data
|
COPY --from=build /app/mnemo_cards_backend/data /app/data
|
||||||
|
|
||||||
# Writable dirs for isar/backups by default
|
# Writable dirs for isar/backups by default
|
||||||
RUN mkdir -p /app/isar /app/backups
|
RUN mkdir -p /app/isar /app/backups && \
|
||||||
|
chmod -R 755 /app/isar /app/backups
|
||||||
|
|
||||||
ENV PORT=8081 \
|
ENV PORT=8081 \
|
||||||
ADDRESS=0.0.0.0 \
|
ADDRESS=0.0.0.0 \
|
||||||
ISAR_DIR=/app/isar \
|
ISAR_DIR=/app/isar \
|
||||||
BACKUP_DIR=/app/backups \
|
BACKUP_DIR=/app/backups \
|
||||||
WORKDIR=/app
|
APP_WORKDIR=/app
|
||||||
|
|
||||||
|
|
||||||
EXPOSE 8081
|
EXPOSE 8081
|
||||||
|
|
||||||
# Healthcheck (tune path if different)
|
# Healthcheck - use existing public endpoint
|
||||||
HEALTHCHECK --interval=15s --timeout=5s --start-period=10s --retries=5 \
|
HEALTHCHECK --interval=15s --timeout=5s --start-period=10s --retries=5 \
|
||||||
CMD curl -f http://127.0.0.1:${PORT}/health || exit 1
|
CMD curl -sf http://127.0.0.1:8081/api/v2/subscriptions/plans || exit 1
|
||||||
|
|
||||||
|
# Use environment variables with fallbacks
|
||||||
CMD ["/app/server", "-a", "0.0.0.0", "-p", "8081", "--isar", "/app/isar", "--backup", "/app/backups", "--workdir", "/app"]
|
CMD ["/app/server", "-a", "0.0.0.0", "-p", "8081", "--isar", "/app/isar", "--backup", "/app/backups", "--workdir", "/app"]
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue