-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
1 changed file
with
25 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# 가져올 이미지를 정의 | ||
FROM node:14 | ||
# 경로 설정하기 | ||
WORKDIR /app | ||
# package.json 워킹 디렉토리에 복사 (.은 설정한 워킹 디렉토리를 뜻함) | ||
COPY package.json . | ||
# 명령어 실행 (의존성 설치) | ||
RUN npm install | ||
# 현재 디렉토리의 모든 파일을 도커 컨테이너의 워킹 디렉토리에 복사한다. | ||
COPY . . | ||
|
||
# 각각의 명령어들은 한줄 한줄씩 캐싱되어 실행된다. | ||
# package.json의 내용은 자주 바뀌진 않을 거지만 | ||
# 소스 코드는 자주 바뀌는데 | ||
# npm install과 COPY . . 를 동시에 수행하면 | ||
# 소스 코드가 조금 달라질때도 항상 npm install을 수행해서 리소스가 낭비된다. | ||
|
||
# 3000번 포트 노출 | ||
EXPOSE 3000 | ||
|
||
# npm start 스크립트 실행 | ||
CMD ["npm", "start"] | ||
|
||
# 그리고 Dockerfile로 docker 이미지를 빌드해야한다. | ||
# $ docker build . |