Update README.md #53
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
name: Docker CI/CD | |
on: | |
push: | |
branches: ['develop'] | |
env: | |
DOCKER_IMAGE: ghcr.io/klaus9267/yeoreum | |
VERSION: ${{ github.sha }} | |
NAME: docker_cicd | |
jobs: | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out source code | |
uses: actions/checkout@v3 | |
# docker build 수행 | |
- name: Set up docker buildx | |
id: buildx | |
uses: docker/setup-buildx-action@v1 | |
# docker login | |
- name: Login to ghcr | |
uses: docker/login-action@v1 | |
with: | |
registry: ghcr.io | |
username: klaus9267 | |
password: ${{ secrets.yeoreum }} | |
# # docker image push | |
- name: Build and push | |
id: docker_build | |
uses: docker/build-push-action@v2 | |
with: | |
builder: ${{ steps.buildx.outputs.name }} | |
push: true | |
tags: ${{ env.DOCKER_IMAGE }}:latest | |
# 배포 | |
deploy: | |
needs: build | |
name: Deploy | |
runs-on: [self-hosted, label-go] | |
steps: | |
- name: Login to ghcr | |
uses: docker/login-action@v1 | |
with: | |
registry: ghcr.io | |
username: klaus9267 | |
password: ${{ secrets.yeoreum }} | |
- name: Docker run | |
run: | | |
cd ~/summer | |
docker-compose down | |
docker rmi ghcr.io/klaus9267/yeoreum | |
docker-compose pull | |
docker-compose up -d |