mirror of
https://github.com/netbirdio/docs.git
synced 2026-08-24 16:51:26 +02:00
Switch pr-build and the Docker image from `npm install` to `npm ci` (`npm ci --omit=dev` in the image), and enable setup-node's npm cache. Deterministic installs from the committed lockfile; CI now fails fast on an out-of-sync lockfile. Depends on the lockfile being tracked (PR #838) — npm ci requires a committed package-lock.json.
32 lines
661 B
Docker
32 lines
661 B
Docker
FROM node:20-alpine
|
|
|
|
# Set working directory
|
|
WORKDIR /usr/app
|
|
|
|
# Install PM2 globally
|
|
RUN npm install --global pm2
|
|
|
|
# Copy package.json and package-lock.json before other files
|
|
# Utilise Docker cache to save re-installing dependencies if unchanged
|
|
COPY ./package*.json ./
|
|
|
|
# Install dependencies (npm ci = clean, reproducible install from the lockfile)
|
|
RUN npm ci --omit=dev
|
|
|
|
# Copy all files
|
|
COPY ./ ./
|
|
|
|
COPY /docker/entrypoint.sh ./entrypoint.sh
|
|
|
|
# Build app
|
|
RUN npm run build
|
|
|
|
RUN chmod u+x /usr/app/entrypoint.sh
|
|
|
|
# Expose the listening port
|
|
EXPOSE 3000
|
|
|
|
# apply env variables to the Nextjs .env file
|
|
ENTRYPOINT ["/usr/app/entrypoint.sh"]
|
|
|
|
CMD npm run start |