simple-links/Dockerfile
Fascinated 56ebc94673
Some checks failed
Publish Docker Image / docker (push) Failing after 19s
another attempt at making it smaller
2023-07-12 11:28:23 +01:00

29 lines
619 B
Docker

# Use a smaller base image
FROM node:lts-slim
ENV NODE_ENV=production
WORKDIR /usr/src/app
# Copy package.json and package-lock.json separately to fully utilize Docker layer caching
COPY package.json ./
COPY package-lock.json ./
RUN npm ci --production --silent && npm cache clean --force
# Copy only necessary files for production
COPY .next ./.next
COPY public ./public
COPY config.json ./
COPY next.config.js ./
# Opt out of Next.js telemetry
RUN npx next telemetry disable
# Expose port 3000
EXPOSE 3000
# Set permissions and user
RUN chown -R node /usr/src/app
USER node
# Start the app
CMD ["npm", "start"]