mirror of
https://github.com/timokz/flutter-vienna-hackathon-25.git
synced 2025-11-08 23:24:20 +01:00
This cost me an entire afternoon. I don't know whose bright idea it was to just slap all arguments into the ENTRYPOINT, but here we are. ENTRYPOINT now just runs the `server` executable, while COMMAND is used to pass arguments / flags to it. This is useful for e.g. passing `--apply-migrations` for deployments. Signed-off-by: Max R. Carrara <max@aequito.sh>
41 lines
1 KiB
Docker
41 lines
1 KiB
Docker
# Build stage
|
|
FROM dart:3.5.0 AS build
|
|
WORKDIR /app
|
|
# TODO: more fine-grained building
|
|
COPY . .
|
|
|
|
# Install dependencies and compile the server executable
|
|
RUN dart pub get
|
|
RUN dart compile exe bin/main.dart -o bin/server
|
|
|
|
# Final stage
|
|
FROM alpine:3.22
|
|
|
|
# Environment variables
|
|
ENV runmode=production
|
|
ENV serverid=default
|
|
ENV logging=normal
|
|
ENV role=monolith
|
|
|
|
# Copy runtime dependencies
|
|
COPY --from=build /runtime/ /
|
|
|
|
# Copy compiled server executable
|
|
COPY --from=build /app/bin/server server
|
|
|
|
# Copy configuration files and resources
|
|
# TODO: don't copy entire config dir, only what's needed
|
|
COPY --from=build /app/config/ config/
|
|
COPY --from=build /app/web/ web/
|
|
COPY --from=build /app/migrations/ migrations/
|
|
|
|
# This file is required to enable the endpoint log filter in Insights.
|
|
COPY --from=build /app/lib/src/generated/protocol.yaml lib/src/generated/protocol.yaml
|
|
|
|
# Expose ports
|
|
EXPOSE 8080
|
|
EXPOSE 8081
|
|
EXPOSE 8082
|
|
|
|
ENTRYPOINT ["/server"]
|
|
CMD ["--mode", "production", "--server-id", "default", "--logging", "normal", "--role", "monolith"]
|