Skip to content

Commit

Permalink
Create cicd.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
kmaxii authored Jul 9, 2024
1 parent 85ab5a4 commit e16f3f8
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/cicd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Deploy to Oracle Cloud

on:
push:
branches:
- docker

jobs:
build:
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 Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}

- name: Build and push Docker image
run: |
docker buildx build --platform linux/amd64 --push -t ${{ secrets.DOCKER_HUB_USERNAME }}/vow-website:latest .
- name: Deploy to Oracle Cloud
env:
OCI_CLI_AUTH: instance_principal
run: |
ssh -i ${{ secrets.ORACLE_CLOUD_SSH_PRIVATE_KEY }} ${{ secrets.ORACLE_CLOUD_SSH_USER }}@${{ secrets.ORACLE_CLOUD_IP }} << EOF
git pull origin master
docker compose down
docker compose pull
docker compose up -d
EOF

0 comments on commit e16f3f8

Please sign in to comment.