-
Notifications
You must be signed in to change notification settings - Fork 1
41 lines (34 loc) · 1.08 KB
/
ci.yml
File metadata and controls
41 lines (34 loc) · 1.08 KB
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
39
40
41
name: News Intelligent CI
on:
push:
branches:
- develop
jobs:
build:
# ubuntu 버전 지정
runs-on: ubuntu-22.04
env:
REGISTRY: ${{secrets.DOCKERHUB_USERNAME}}
IMAGE: ${{secrets.DOCKERHUB_REPOSITORY}}
TAG: ${{github.sha}}
steps:
# GitHub 레포지토리 checkout
- name: Checkout repository
uses: actions/checkout@v3
# DockerHub 로그인
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{secrets.DOCKERHUB_USERNAME}}
password: ${{secrets.DOCKERHUB_ACCESS_TOKEN}}
# Docker 이미지 빌드 및 푸시
- name: Build & Push Docker image
run: |
docker build --pull --no-cache -t $REGISTRY/$IMAGE:$TAG .
docker push $REGISTRY/$IMAGE:$TAG
# latest tag (develop branch)
- name: Push :latest
if: github.ref == 'refs/heads/develop' # push 이벤트에서 develop 일 때만
run: |
docker tag $REGISTRY/$IMAGE:$TAG $REGISTRY/$IMAGE:latest
docker push $REGISTRY/$IMAGE:latest