[docs]시연영상 추가 (#238) #65
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: auto deploy front | |
on: | |
push: | |
branches: | |
- dev | |
jobs: | |
docker_push_front: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Login to NCP Container Registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ${{ secrets.NCP_CONTAINER_REGISTRY }} | |
username: ${{ secrets.NCP_ACCESS_KEY }} | |
password: ${{ secrets.NCP_SECRET_KEY }} | |
- name: Build and Push Docker Image | |
uses: docker/build-push-action@v3 | |
with: | |
context: ./client | |
file: ./client/Dockerfile | |
push: true | |
tags: ${{ secrets.NCP_CONTAINER_REGISTRY }}/front | |
cache-from: type=registry,ref=${{ secrets.NCP_CONTAINER_REGISTRY }}/front | |
cache-to: type=inline | |
build-args: | | |
VITE_API_URL=${{ secrets.VITE_API_URL }} | |
VITE_HLS_URL=${{ secrets.VITE_HLS_URL }} | |
docker_pull_front: | |
name: Connect server ssh and pull frontend from container registry | |
needs: docker_push_front | |
runs-on: ubuntu-latest | |
steps: | |
- name: connect ssh | |
uses: appleboy/ssh-action@master | |
with: | |
host: ${{ secrets.FRONT_HOST }} | |
username: ${{ secrets.FRONT_USERNAME }} | |
password: ${{ secrets.FRONT_PASSWORD }} | |
port: ${{ secrets.FRONT_PORT }} | |
script: | | |
docker pull ${{ secrets.NCP_CONTAINER_REGISTRY }}/front | |
docker stop $(docker ps -a -q) | |
docker rm $(docker ps -a -q) | |
docker run -d -p 80:80 -p 443:443 --name front ${{ secrets.NCP_CONTAINER_REGISTRY }}/front | |
docker image prune -f | |
docker cp /etc/letsencrypt/archive/gbs-live.site/fullchain1.pem front:/ | |
docker cp /etc/letsencrypt/archive/gbs-live.site/privkey1.pem front:/ | |
docker cp default.conf front:/etc/nginx/conf.d/ | |
docker exec front nginx -s reload |