File size: 569 Bytes
eca227d 92f11da eca227d 92f11da eca227d 92f11da eca227d 92f11da eca227d |
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 |
FROM node:alpine
# Set the working directory
WORKDIR /app
# Copy package.json and pnpm-lock.yaml (if available)
COPY package.json package-lock.json* ./
# Install all dependencies, including dev dependencies
RUN npm install --frozen-lockfile
# Copy the rest of the application code
COPY . .
# Build the application
RUN npm run build
# Prune dev dependencies
RUN npm prune --prod
# Set correct permissions
RUN chown -R node:node /app
# Switch to non-root user
USER node
# Expose the port the app runs on
EXPOSE 3000
# Start the application
CMD ["node", "build"] |