-
Notifications
You must be signed in to change notification settings - Fork 243
/
Copy pathDockerfile.node
28 lines (22 loc) · 946 Bytes
/
Dockerfile.node
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
FROM node:22.14.0-slim@sha256:bac8ff0b5302b06924a5e288fb4ceecef9c8bb0bb92515985d2efdc3a2447052 as builder-base
WORKDIR /usr/src/pyth
ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH"
RUN apt-get update && apt-get install -y git python3 make gcc g++ curl && corepack enable
RUN npm install -g [email protected]
COPY ./ .
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile
FROM node:22.14.0-alpine3.21@sha256:9bef0ef1e268f60627da9ba7d7605e8831d5b56ad07487d24d1aa386336d1944 as runner-base
WORKDIR /srv
ENV NODE_ENV production
RUN addgroup --system --gid 1001 pyth && adduser --system --uid 1001 pyth -g pyth && chown pyth:pyth .
USER pyth
FROM builder-base AS builder
ARG package
ENV CI true
RUN pnpm turbo build --filter $package
RUN pnpm deploy --legacy --filter $package --prod /srv/$package
FROM runner-base AS runner
ARG package
COPY --from=builder --chown=pyth:pyth /srv/${package} ./
CMD [ "npm", "start" ]