generated from Fascinated/nextjs-13-template-with-tailwindcss
attempt to make the image smaller
All checks were successful
Publish Docker Image / docker (push) Successful in 3m55s
All checks were successful
Publish Docker Image / docker (push) Successful in 3m55s
This commit is contained in:
parent
fb73bb6fe7
commit
e321ce1cb4
25
Dockerfile
25
Dockerfile
@ -1,20 +1,29 @@
|
|||||||
FROM node:lts-alpine
|
# Use a smaller base image
|
||||||
|
FROM node:lts-slim
|
||||||
|
|
||||||
ENV NODE_ENV=production
|
ENV NODE_ENV=production
|
||||||
WORKDIR /usr/src/app
|
WORKDIR /usr/src/app
|
||||||
COPY ["package.json", "package-lock.json*", "npm-shrinkwrap.json*", "./"]
|
|
||||||
RUN npm install --production --silent && mv node_modules ../
|
|
||||||
COPY . .
|
|
||||||
EXPOSE 3000
|
|
||||||
|
|
||||||
# Opt out of NextJS telemetry
|
# 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 the rest of the files
|
||||||
|
COPY . .
|
||||||
|
|
||||||
|
# Opt out of Next.js telemetry
|
||||||
RUN npx next telemetry disable
|
RUN npx next telemetry disable
|
||||||
|
|
||||||
# Build the app
|
# Build the app
|
||||||
#RUN npm run build
|
#RUN npm run build
|
||||||
|
|
||||||
# Setup permissions
|
# Expose port 3000
|
||||||
|
EXPOSE 3000
|
||||||
|
|
||||||
|
# Set permissions and user
|
||||||
RUN chown -R node /usr/src/app
|
RUN chown -R node /usr/src/app
|
||||||
USER node
|
USER node
|
||||||
|
|
||||||
CMD ["npm", "start"]
|
# Start the app
|
||||||
|
CMD ["npm", "start"]
|
Loading…
Reference in New Issue
Block a user