You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
703 B
Docker
23 lines
703 B
Docker
FROM node:22-slim AS base
|
|
ENV PNPM_HOME="/pnpm"
|
|
ENV PATH="$PNPM_HOME:$PATH"
|
|
RUN corepack enable
|
|
|
|
|
|
# use Docker layers as the build cache instead of the local pnpm cache (I chose this method because this works in all environments, even ephemeral Github Actions VMs):
|
|
FROM base AS prod
|
|
WORKDIR /app
|
|
COPY pnpm-lock.yaml /app
|
|
RUN pnpm fetch --prod
|
|
COPY . /app
|
|
RUN pnpm run build
|
|
|
|
|
|
FROM base
|
|
WORKDIR /app
|
|
COPY --from=prod /app/node_modules /app/node_modules
|
|
COPY --from=prod /app/dist /app
|
|
EXPOSE 4321
|
|
# set the host to 0.0.0.0 so that it can be accessed from outside the container (doesn't work without this, even with the `-p 4321:4321` docker option):
|
|
ENV HOST="0.0.0.0"
|
|
CMD [ "node", "server/entry.mjs" ] |