45 lines
912 B
Docker
45 lines
912 B
Docker
FROM dart:3.10.1 AS builder
|
|
|
|
WORKDIR /app
|
|
|
|
# Copy only pubspec files first for better caching
|
|
COPY pubspec.yaml pubspec.lock ./
|
|
|
|
# Install dependencies
|
|
RUN dart pub get
|
|
|
|
# Copy all source files
|
|
COPY . .
|
|
|
|
# Build the Dart application
|
|
RUN dart pub get && dart compile exe bin/server.dart -o bin/server.exe
|
|
|
|
# Production stage
|
|
FROM debian:bookworm-slim AS production
|
|
|
|
RUN apt-get update && apt-get install -y \
|
|
curl \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
WORKDIR /app
|
|
|
|
# Copy the compiled executable from builder
|
|
COPY --from=builder /app/bin/server.exe ./bin/server.exe
|
|
|
|
# Copy the built Flutter web app
|
|
COPY web/ ./web/
|
|
|
|
# Set environment variables
|
|
ENV PORT=9090
|
|
ENV POSTGRES_HOST=localhost
|
|
ENV POSTGRES_PORT=5432
|
|
ENV POSTGRES_DB=family_safety
|
|
ENV POSTGRES_USER=postgres
|
|
ENV POSTGRES_PASSWORD=postgres
|
|
ENV JWT_SECRET=your-super-secret-key-change-me
|
|
ENV TOKEN_LIFETIME=600
|
|
|
|
EXPOSE 9090
|
|
|
|
CMD ["./bin/server.exe"]
|