NextJS 배포하기 - NextJS, Travis Setup
NextJS 프로젝트 생성
$ npx create-next-app sample-next
$ cd sample-next
$ npm run dev 
Git Repository 추가


Travis CI






Last updated
Was this helpful?
$ npx create-next-app sample-next
$ cd sample-next
$ npm run dev 








Last updated
Was this helpful?
Was this helpful?
$ git init
$ git add .
$ git commit -m "initial commit"
$ git remote add origin <본인 repo 주소>
$ git push origin master# .travis.yml
language: node_js
node_js:
- '12'
services: # docker 로 감싸서 배포할거에요
- docker
before_install:
- echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin
- docker build -t sample-next -f Dockerfile .
branches: # 해당 브렌치로 push 될 경우에만 반응합니다
only:
- master
notifications: # 변경사항이 있을때 알림을 받을 수 있도록
email:
on_success: change
on_failure: always
recipients:
- <본인 이메일># Dockerfile
FROM node:12 as base
WORKDIR /app
COPY package.json package-lock.json ./
RUN npm ci
ENV CONTINUOUS_INTEGRATION=1
ENV NODE_ENV=production
COPY . .
RUN npm run build
# next 의 default port 는 3000 번 이지만 beanstalk 의 default port 는 8081 이기 때문에
# 간편하게 맞추고자 8081 로 실행합니다.
EXPOSE 8081
CMD [ "npm", "start" ]