28 lines
682 B
Docker
28 lines
682 B
Docker
FROM node:20-alpine
|
|
|
|
WORKDIR /app
|
|
|
|
# The npm version bundled with node:20-alpine has a known "Exit handler
|
|
# never called!" bug under slow/unreliable networks (common on VPS hosts).
|
|
# Upgrading npm first, plus more tolerant retry/timeout settings, avoids it.
|
|
RUN npm install -g npm@11 \
|
|
&& npm config set fetch-retries 5 \
|
|
&& npm config set fetch-retry-mintimeout 20000 \
|
|
&& npm config set fetch-timeout 300000
|
|
|
|
COPY package.json package-lock.json ./
|
|
RUN npm ci --omit=dev && node -e "require('express')"
|
|
|
|
COPY server.js ./
|
|
COPY src ./src
|
|
COPY public ./public
|
|
COPY locales ./locales
|
|
|
|
RUN chown -R node:node /app
|
|
USER node
|
|
|
|
ENV PORT=3000
|
|
EXPOSE 3000
|
|
|
|
CMD ["node", "server.js"]
|