Spaces:
Running
Running
File size: 1,026 Bytes
66adc5d 356ce10 c51eb83 000ed50 6671664 356ce10 74532d2 356ce10 74532d2 356ce10 ff2db2e 74532d2 c51eb83 74532d2 a696fed fda044f dc0d663 74532d2 |
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 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# syntax=docker/dockerfile:1
# read the doc: https://huggingface.co/docs/hub/spaces-sdks-docker
# you will also find guides on how best to write your Dockerfile
FROM node:20 as builder-production
WORKDIR /app
COPY --link --chown=1000 package-lock.json package.json ./
RUN --mount=type=cache,target=/app/.npm \
npm set cache /app/.npm && \
npm ci --omit=dev
FROM builder-production as builder
RUN --mount=type=cache,target=/app/.npm \
npm set cache /app/.npm && \
npm ci
COPY --link --chown=1000 . .
RUN --mount=type=secret,id=DOTENV_LOCAL,dst=.env.local \
npm run build
FROM node:20-slim
RUN npm install -g pm2
RUN userdel -r node
RUN useradd -m -u 1000 user
USER user
ENV HOME=/home/user \
PATH=/home/user/.local/bin:$PATH
COPY --from=builder-production --chown=1000 /app/node_modules /app/node_modules
COPY --link --chown=1000 package.json /app/package.json
COPY --from=builder --chown=1000 /app/build /app/build
CMD pm2 start /app/build/index.js -i $CPU_CORES --no-daemon
|