35 lines
658 B
Docker
35 lines
658 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/
|
|
|
|
EXPOSE 9090
|
|
|
|
CMD ["./bin/server.exe"]
|