mirror of
https://github.com/Aviortheking/next-template.git
synced 2025-07-24 06:19:49 +00:00
40
Dockerfile
40
Dockerfile
@ -1,13 +1,37 @@
|
||||
# Production Dockerfile
|
||||
|
||||
FROM node:alpine as BUILD_IMAGE
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
ADD package.json package-lock.json ./
|
||||
|
||||
# install dependencies
|
||||
RUN npm i
|
||||
|
||||
# Add project files
|
||||
ADD . .
|
||||
|
||||
# build
|
||||
RUN npm run build
|
||||
|
||||
# remove dev dependencies
|
||||
RUN npm prune --production
|
||||
|
||||
# go to another VM
|
||||
FROM node:alpine
|
||||
|
||||
# instal yarn
|
||||
RUN apk -q add yarn
|
||||
# go to folder
|
||||
WORKDIR /app
|
||||
|
||||
# Go to user home
|
||||
WORKDIR /home/tcgdex
|
||||
# copy from build image
|
||||
COPY --from=BUILD_IMAGE /app/package.json ./package.json
|
||||
COPY --from=BUILD_IMAGE /app/node_modules ./node_modules
|
||||
COPY --from=BUILD_IMAGE /app/.next ./.next
|
||||
COPY --from=BUILD_IMAGE /app/public ./public
|
||||
|
||||
COPY . .
|
||||
# Expose port
|
||||
EXPOSE 3000
|
||||
|
||||
RUN yarn && yarn build && yarn sitemap
|
||||
|
||||
CMD ["yarn", "server"]
|
||||
# run it !
|
||||
CMD ["npm", "run", "start"]
|
||||
|
Reference in New Issue
Block a user