generated from Fascinated/nextjs-13-template-with-tailwindcss
Fascinated
c5dfa63e1a
All checks were successful
Publish Docker Image / docker (push) Successful in 3m44s
29 lines
593 B
Docker
29 lines
593 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
|
|
|
|
# Opt out of Next.js telemetry
|
|
RUN npx next telemetry disable
|
|
|
|
# Copy the rest of the files
|
|
COPY . .
|
|
|
|
# Remove development dependencies
|
|
RUN npm prune --production
|
|
|
|
# Expose port 3000
|
|
EXPOSE 3000
|
|
|
|
# Set permissions and user
|
|
RUN chown -R node /usr/src/app
|
|
USER node
|
|
|
|
# Start the app
|
|
CMD ["npm", "start"] |