https://github.com/potato4d/docker-multi-stage-build-on-nuxt
https://github.com/potato4d/docker-multi-stage-build-on-nuxt
docker multistage-docker nuxt nuxtjs
Last synced: 9 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/potato4d/docker-multi-stage-build-on-nuxt
- Owner: potato4d
- Archived: true
- Created: 2019-08-26T00:21:06.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2023-03-04T04:35:25.000Z (over 3 years ago)
- Last Synced: 2024-10-16T21:46:05.190Z (over 1 year ago)
- Topics: docker, multistage-docker, nuxt, nuxtjs
- Language: Vue
- Homepage: https://nuxt-meetup.connpass.com/event/135514/
- Size: 313 KB
- Stars: 20
- Watchers: 3
- Forks: 1
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Docker multi stage build on Nuxt.js project
This is a sample for Nuxt Meetup (in Japan) of 2019/08/26.
## Stack
- Nuxt.js v2.9
- Universal Mode
- with TypeScript
- Docker v19.x
- with docker-compose v3.x
- CircleCI v2.x
- use machine image
## Structure
Using Docker's multi stage build (available from 17.05), the development environment, build environment, and production environment can be shared with a single Dockerfile.
```Dockerfile
# For development
FROM node:10.16.1-alpine as dev-env
WORKDIR /app
COPY . /app
RUN apk update
RUN yarn
EXPOSE 3000
CMD ["yarn", "dev"]
# For build
FROM node:10.16.1-alpine as build-env
WORKDIR /app
COPY . /app
RUN apk update
RUN yarn
RUN yarn build
# For production
FROM node:10.16.1-alpine
WORKDIR /app
COPY . /app
# Copy from another build
COPY --from=build-env /app/.nuxt /app/.nuxt
RUN yarn
EXPOSE 3000
CMD ["yarn", "start"]
```