Skip to content

refactor : move path #65

refactor : move path

refactor : move path #65

Workflow file for this run

name: CI-CD
on:
push:
branches:
- page
jobs:
build:
runs-on: ubuntu-latest
environment: CI/CD
permissions:
contents: read
packages: write
steps:
- name: checkout
uses: actions/checkout@v3
- name: setup docker
uses: docker/setup-buildx-action@v2
- name: Add KAKAO_API_KEY to .env.production
run: |
echo -e "\n KAKAO_API_KEY=${{ secrets.KAKAO_API_KEY }}" >> packages/page/.env.production
- name: login contianer registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: docker build & push
run: docker buildx build -f ./packages/page/Dockerfile --platform linux/amd64,linux/arm64 -t ghcr.io/${{ github.repository }}/page:latest --push .
deploy:
runs-on: ubuntu-latest
needs: build
steps:
- name: install ssh
run: |
sudo apt-get update
sudo apt-get install -y sshpass
- name: deploy
env:
ORACLE_IP: ${{ secrets.ORACLE_INSTANCE_IP }}
SSH_PRIVATE_KEY: ${{ secrets.ORACLE_SSH_PRIVATE_KEY }}
run: |
echo "$SSH_PRIVATE_KEY" > private_key
chmod 600 private_key
ssh -o StrictHostKeyChecking=no -i private_key ubuntu@$ORACLE_IP << 'EOF'
docker login ghcr.io -u $GITHUB_ACTOR -p $GITHUB_TOKEN
docker pull ghcr.io/${{ github.repository }}/page:latest
docker stop invite-page || true
docker rm invite-page || true
docker run -d -p 5001:5001 --network my-network --name invite-page ghcr.io/${{ github.repository }}/page:latest
EOF