-
Notifications
You must be signed in to change notification settings - Fork 6
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
13 additions
and
33 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,38 +1,19 @@ | ||
FROM node:lts AS builder | ||
FROM node:lts-slim AS base | ||
|
||
# make workdir /app | ||
WORKDIR /app | ||
|
||
# install pnpm | ||
RUN corepack enable && corepack prepare pnpm@v9.10.0 --activate | ||
|
||
# Install requested packages | ||
COPY pnpm-lock.yaml ./ | ||
RUN pnpm fetch | ||
|
||
# Copy app source and install dependencies | ||
COPY . . | ||
RUN pnpm install -r --offline --ignore-scripts | ||
ENV PNPM_HOME="/pnpm" | ||
ENV PATH="$PNPM_HOME:$PATH" | ||
RUN corepack enable | ||
|
||
# transpile to js | ||
RUN pnpm build | ||
FROM base AS prod | ||
|
||
FROM node:lts-alpine AS final | ||
|
||
# make workdir /app | ||
COPY pnpm-lock.yaml /app | ||
WORKDIR /app | ||
|
||
# install pnpm | ||
RUN corepack enable && corepack prepare pnpm@v9.10.0 --activate | ||
|
||
# Fetch production packages | ||
COPY pnpm-lock.yaml ./ | ||
RUN pnpm fetch --prod | ||
|
||
# copy transpiled code, install prod dependencies | ||
COPY --from=builder ./app/dist ./dist | ||
COPY package.json . | ||
RUN pnpm install -r --offline --prod --ignore-scripts | ||
COPY . /app | ||
RUN pnpm run build | ||
|
||
# start server | ||
CMD cd dist && node deploy-commands.js && node . | ||
FROM base | ||
COPY --from=prod /app/node_modules /app/node_modules | ||
COPY --from=prod /app/dist /app/dist | ||
CMD [ "pnpm", "start" ] |
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