-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
40 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# This is expected to be invoked with /packages as the context. | ||
# Example: | ||
# cd packages | ||
# docker build -t cli -f cli/Dockerfile . | ||
FROM dart:stable AS build | ||
ARG BIN=cli | ||
|
||
# Resolve app dependencies. | ||
WORKDIR /app | ||
COPY openapi/pubspec.* ./openapi/ | ||
COPY types/pubspec.* ./types/ | ||
COPY db/pubspec.* ./db/ | ||
COPY cli/pubspec.* ./cli/ | ||
WORKDIR /app/cli | ||
RUN dart pub get | ||
|
||
# Copy all packages and build them. | ||
WORKDIR /app | ||
COPY . . | ||
|
||
WORKDIR /app/cli | ||
RUN dart pub get --offline | ||
|
||
RUN mkdir -p /app/bin | ||
RUN dart compile exe bin/${BIN}.dart -o /app/bin/server | ||
|
||
# Build minimal serving image from AOT-compiled `/server` and required system | ||
# libraries and configuration files stored in `/runtime/` from the build stage. | ||
FROM scratch | ||
COPY --from=build /runtime/ / | ||
COPY --from=build /app/bin/server /app/bin/ | ||
|
||
CMD ["/app/bin/server"] |