-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update docker to run on both production and development (#6)
- Loading branch information
1 parent
d0f32c2
commit 0760f24
Showing
4 changed files
with
59 additions
and
22 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,25 @@ | ||
# Use latest stable channel SDK. | ||
FROM dart:stable AS build | ||
FROM dart:stable AS base | ||
|
||
# Resolve app dependencies. | ||
WORKDIR /app | ||
COPY pubspec.* ./ | ||
RUN dart pub get | ||
|
||
# Copy app source code (except anything in .dockerignore) and AOT compile app. | ||
COPY . . | ||
|
||
# build for production | ||
RUN dart run build_runner build --delete-conflicting-outputs | ||
RUN dart compile exe bin/server.dart -o bin/server | ||
|
||
FROM base as development | ||
RUN dart pub global activate dox | ||
CMD ["dox", "s"] | ||
|
||
# Build minimal serving image from AOT-compiled `/server` | ||
# and the pre-built AOT-runtime in the `/runtime/` directory of the base image. | ||
FROM scratch | ||
COPY --from=build /runtime/ / | ||
COPY --from=build /app/.env / | ||
COPY --from=build /app/bin/server /bin/ | ||
COPY --from=build /app/db/migration /db/migration | ||
|
||
# Start server. | ||
FROM scratch as production | ||
COPY --from=base /runtime/ / | ||
COPY --from=base /app/.env / | ||
COPY --from=base /app/bin/server /bin/ | ||
COPY --from=base /app/db/migration /db/migration | ||
CMD ["/bin/server"] |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.