Skip to content

Instantly share code, notes, and snippets.

@teitei-tk
Last active October 26, 2020 11:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save teitei-tk/5ae9bf3379270276c310ae0ec5cd480f to your computer and use it in GitHub Desktop.
Save teitei-tk/5ae9bf3379270276c310ae0ec5cd480f to your computer and use it in GitHub Desktop.
Next.js Multi Stage Build Dockerfile
FROM node:14-alpine as base
WORKDIR /app/js/base
COPY package.json .
COPY yarn.lock .
COPY tsconfig.json .
RUN yarn install
COPY . .
FROM node:14-alpine as builder
ENV NODE_ENV=production
WORKDIR /app/js/builder
COPY --from=base /app/js/base /app/js/builder
RUN ["yarn", "build"]
FROM nginx:latest as production
WORKDIR /app/js/src
RUN rm -rf /etc/nginx/conf.d
ADD conf/nginx/conf.d /etc/nginx/conf.d
COPY --from=builder /app/js/builder/out ./out
EXPOSE 80
{
"name": "go-next.js-playground",
"version": "1.0.0",
"main": "index.js",
"repository": "ssh://git@github.com/teitei-tk/go-next.js-playground.git",
"author": "teitei-tk <teitei.tk@gmail.com>",
"license": "MIT",
"private": true,
"scripts": {
"dev": "next",
"build": "next build && next export",
"start": "next start"
},
"dependencies": {
"next": "^9.4.4",
"react": "^16.13.1",
"react-dom": "^16.13.1",
"semantic-ui-css": "^2.4.1",
"semantic-ui-react": "^1.1.1"
},
"devDependencies": {
"@types/node": "^14.0.23",
"@types/react": "^16.9.43",
"file-loader": "^6.0.0",
"typescript": "^3.9.7",
"url-loader": "^4.1.0"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment