-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
38 lines (36 loc) · 1.1 KB
/
.gitlab-ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
stages:
- build
- deploy
- test
- sync
build-deploy-test:
image: docker:latest
stage: build
services:
- docker:dind
script:
- echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USER" --password-stdin
# 이미지 빌드 시 버전 태그를 사용
- docker build -t $DOCKER_USER/quotis:1.0.0 -f CICD/Dockerfile .
- docker push $DOCKER_USER/quotis:1.0.0
- docker pull $DOCKER_USER/quotis:1.0.0
- docker run -d -p 80:3000 --name webapp $DOCKER_USER/quotis:1.0.0
- sleep 120 # 컨테이너가 정상적으로 시작되도록 충분한 시간을 제공
- docker logs webapp # 컨테이너 로그 출력.
- docker exec webapp npm test
only:
- main
environment:
name: production
sync_to_github:
stage: sync
before_script:
- git config --global user.email "[email protected]"
- git config --global user.name "ji24077"
- git remote add github https://ji24077:[email protected]/UofT-UTSC-CS-sandbox/final-term-project-quotis.git
- git fetch github
- git checkout --track github/main
script:
- git push github main
only:
- main