-
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.
perf(docker): prefer
distroless
containers for runtime
- Loading branch information
Showing
2 changed files
with
7 additions
and
9 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,24 +1,22 @@ | ||
# syntax=docker/dockerfile:1.7-labs | ||
FROM node:22.5.1-alpine3.20 AS build | ||
ENV PNPM_HOME="/pnpm" | ||
ENV PATH="$PNPM_HOME:$PATH" | ||
RUN corepack enable pnpm | ||
WORKDIR /drap | ||
COPY pnpm-lock.yaml ./ | ||
COPY pnpm-lock.yaml . | ||
RUN pnpm fetch | ||
COPY . ./ | ||
COPY . . | ||
RUN pnpm install --recursive --offline | ||
RUN pnpm --filter=drap-email --prod deploy /prod/email && pnpm --filter=drap-app --prod deploy /prod/app | ||
RUN pnpm --parallel --recursive build && mv email/dist/ /prod/email && mv app/build/ /prod/app | ||
|
||
FROM node:22.5.1-alpine3.20 AS deploy | ||
COPY --from=build /prod/ /drap/ | ||
FROM gcr.io/distroless/nodejs22-debian12:nonroot-amd64 AS deploy | ||
COPY --from=build /prod/ ~/drap/ | ||
EXPOSE 3000 | ||
USER node | ||
|
||
# This is the command to start the SvelteKit server. The background email worker | ||
# should be spawned as a separate process somehow. When deploying to Fly.io | ||
# (see the fly.toml), we use Process Groups to spawn both the main SvelteKit | ||
# server and the email worker at the same time. For the sake of supplying a | ||
# # default entry point, the following `CMD` starts the SvelteKit server. | ||
CMD ["node", "/prod/app/build/index.js"] | ||
CMD ["~/drap/app/build/index.js"] |
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