Dockerize Vue.js App Docs
https://kr.vuejs.org/v2/cookbook/dockerize-vuejs-app.html
vue app 생성
Dockerfile 생성
./vue-test/Dockerfile
# build stage
FROM node:lts-alpine as build-stage
WORKDIR /app
COPY package*.json ./
RUN npm install --production
COPY . .
RUN npm run build
# production stage
FROM nginx:stable-alpine as production-stage
COPY --from=build-stage /app/dist /usr/share/nginx/html
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]
Docker image build
vue-test위치에서 실행한다. (. -> Dockerfile 위치)
docker build -t vue-app .
생성한 image 확인
Docker container 실행
docker run -it -p 8080:80 --rm --name vue-app-1 vue-app
- 8080 port로 expose
실행된 container 확인
실행된 App 확인
localhost:8080 접속
Docker container 중지
docker stop vue-app-1
'FRONTEND > VUE.js' 카테고리의 다른 글
[Vue.js] vue-echarts를 사용해 chart 그리기 (1) | 2020.03.03 |
---|