-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
opt: try adding support for custom UID/GID executions
- Loading branch information
Showing
1 changed file
with
10 additions
and
5 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,28 +1,33 @@ | ||
# https://github.com/nodejs/docker-node/blob/main/docs/BestPractices.md | ||
FROM node:22.9.0-slim AS base | ||
ENV PNPM_HOME="/pnpm" | ||
ENV PNPM_HOME="/opt/pnpm" | ||
ENV COREPACK_HOME="/opt/corepack" | ||
ENV PATH="$PNPM_HOME:$PATH" | ||
|
||
RUN apt-get update && apt-get install -y \ | ||
git \ | ||
&& rm -rf /var/lib/apt/lists/* \ | ||
&& corepack enable \ | ||
&& corepack prepare pnpm@9 --activate | ||
&& rm -rf /var/lib/apt/lists/* | ||
WORKDIR /app | ||
COPY package.json pnpm-lock.yaml /app/ | ||
|
||
# Do it here to add the packageManager field to the package.json | ||
RUN corepack enable \ | ||
&& corepack prepare pnpm@9 --activate \ | ||
&& corepack use pnpm@9 | ||
|
||
FROM base AS prod-deps | ||
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --prod --frozen-lockfile | ||
|
||
FROM base | ||
RUN corepack use pnpm@9 | ||
COPY --from=prod-deps /app/node_modules /app/node_modules | ||
COPY index.ts /app/ | ||
COPY src/ /app/src/ | ||
|
||
ENV CONFIG_LOCATION=/app/config/config.yml | ||
ENV SECRETS_LOCATION=/app/config/secrets.yml | ||
|
||
RUN chmod uga+rw -R /app/package.json | ||
|
||
#USER node | ||
|
||
CMD [ "pnpm", "start" ] |