Skip to content

Commit

Permalink
Updated workflow to make starting and stopping with docker compose si…
Browse files Browse the repository at this point in the history
…mpler
  • Loading branch information
kmaxii committed Oct 11, 2024
1 parent 4411c65 commit 4886cce
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 14 deletions.
14 changes: 1 addition & 13 deletions .github/workflows/cicd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,28 +49,16 @@ jobs:
rm oracle_cloud_key
- name: Deploy to Oracle Cloud
env:
OCI_CLI_AUTH: instance_principal
DB_ROOT_PASSWORD: ${{ secrets.DB_ROOT_PASSWORD }}
DB_USER: ${{ secrets.DB_USER }}
DB_PASSWORD: ${{ secrets.DB_PASSWORD }}
DOCKER_HUB_USERNAME: ${{ secrets.DOCKER_HUB_USERNAME }}
DOCKER_HUB_ACCESS_TOKEN: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
run: |
echo "${{ secrets.ORACLE_CLOUD_SSH_PRIVATE_KEY }}" > oracle_cloud_key
chmod 600 oracle_cloud_key
ssh -i oracle_cloud_key -o StrictHostKeyChecking=no ${{ secrets.ORACLE_CLOUD_SSH_USER }}@${{ secrets.ORACLE_CLOUD_IP }} << EOF
cd website
docker compose down
echo "$DOCKER_HUB_ACCESS_TOKEN" | docker login -u "$DOCKER_HUB_USERNAME" --password-stdin
export DB_ROOT_PASSWORD=${DB_ROOT_PASSWORD}
export DB_USER=${DB_USER}
export DB_PASSWORD=${DB_PASSWORD}
export DOCKER_IMAGE=${DOCKER_HUB_USERNAME}/vow-website:latest
export DOCKER_IMAGE=${{ secrets.DOCKER_HUB_USERNAME }}/vow-website:latest
export COMPOSE_FILE_DIR=/home/opc/website
docker compose pull
docker compose up -d
docker image prune -f
docker logout
EOF
rm oracle_cloud_key
8 changes: 7 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: '3.8'

services:
web:
image: ${DOCKER_IMAGE:-vow-website:latest}
image: ${DOCKER_IMAGE:-kmaxi/vow-website:latest}
ports:
- "80:80"
environment:
Expand All @@ -20,6 +20,8 @@ services:
- adminer
volumes:
- dynamic_data:/var/www/html/dynamic
env_file:
- .env

website:
image: mariadb:10.5.24
Expand All @@ -32,6 +34,8 @@ services:
- "3306:3306"
volumes:
- website_data:/var/lib/mysql
env_file:
- .env

api:
image: mariadb:10.5.24
Expand All @@ -44,6 +48,8 @@ services:
- "3307:3306"
volumes:
- api_data:/var/lib/mysql
env_file:
- .env

adminer:
image: adminer
Expand Down

0 comments on commit 4886cce

Please sign in to comment.