Skip to content

Commit

Permalink
feat: add Dockerfile for cli
Browse files Browse the repository at this point in the history
  • Loading branch information
eseidel committed Aug 11, 2024
1 parent da48f81 commit b11c867
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 1 deletion.
8 changes: 7 additions & 1 deletion compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,10 @@ services:
web:
build: ./packages/ui
ports:
- "8080:80"
- "8080:80"
cli:
build:
context: ./packages
dockerfile: ./cli/Dockerfile
args:
- BIN=cli
33 changes: 33 additions & 0 deletions packages/cli/Dockerfile
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/

Check warning on line 10 in packages/cli/Dockerfile

View workflow job for this annotation

GitHub Actions / 🔤 Check Spelling / build

Unknown word (pubspec)
COPY types/pubspec.* ./types/

Check warning on line 11 in packages/cli/Dockerfile

View workflow job for this annotation

GitHub Actions / 🔤 Check Spelling / build

Unknown word (pubspec)
COPY db/pubspec.* ./db/

Check warning on line 12 in packages/cli/Dockerfile

View workflow job for this annotation

GitHub Actions / 🔤 Check Spelling / build

Unknown word (pubspec)
COPY cli/pubspec.* ./cli/

Check warning on line 13 in packages/cli/Dockerfile

View workflow job for this annotation

GitHub Actions / 🔤 Check Spelling / build

Unknown word (pubspec)
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"]

0 comments on commit b11c867

Please sign in to comment.