-
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.
refactor(docker): separate install step from source copy
- Loading branch information
Showing
2 changed files
with
15 additions
and
11 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,20 +1,24 @@ | ||
# syntax=docker/dockerfile:1.7-labs | ||
|
||
# https://pnpm.io/docker | ||
FROM node:22.5.1-alpine3.20 AS base | ||
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 . . | ||
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile | ||
|
||
FROM base AS build | ||
COPY pnpm-lock.yaml ./ | ||
RUN pnpm fetch | ||
COPY . ./ | ||
RUN pnpm install --recursive --offline | ||
RUN pnpm --parallel --recursive build | ||
RUN pnpm --filter=drap-email --prod deploy /prod/email | ||
RUN pnpm --filter=drap-app --prod deploy /prod/app | ||
|
||
FROM node:22.5.1-alpine3.20 AS deploy | ||
COPY --from=build /prod /prod | ||
COPY --from=build /prod/ /drap/ | ||
EXPOSE 3000 | ||
CMD tail -f /dev/null | ||
|
||
# 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"] |
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