Skip to content

HOSTFIX: HTTP error. #84

HOSTFIX: HTTP error.

HOSTFIX: HTTP error. #84

Workflow file for this run

name: Deployments
on:
workflow_dispatch:
workflow_call:
push:
branches:
- main
paths-ignore:
- ".github/**"
- ".vscode/**"
env:
MARIADB_ROOT_PASSWORD: ${{ secrets.MARIADB_ROOT_PASSWORD }}
DATABASE_PASSWORD: ${{ secrets.DATABASE_PASSWORD }}
DATABASE_USERNAME: ${{ secrets.DATABASE_USERNAME }}
SECRET_KEY: ${{ secrets.SECRET_KEY }}
ONISEP_EMAIL: ${{ secrets.ONISEP_EMAIL }}
ONISEP_PASSWORD: ${{ secrets.ONISEP_PASSWORD }}
ONISEP_APP_ID: ${{ secrets.ONISEP_APP_ID }}
jobs:
deploy-datatabse:
uses: ./.github/workflows/deploy_database_production.yml
secrets: inherit
deploy-api:
runs-on: self-hosted
needs: [deploy-datatabse]
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Check if container exists
id: check-container
run: |
if docker ps -a | grep -q 'onisep-api'; then
echo "Container onisep api exists"
echo "::set-output name=container_exists::true"
else
echo "Container onisep api does not exist"
echo "::set-output name=container_exists::false"
fi
- name: Stop and Remove Old Container
if: steps.check-container.outputs.container_exists == 'true'
run: docker-compose stop onisep-api && docker-compose rm -f onisep-api
- name: Remove Old Image
if: steps.check-container.outputs.container_exists == 'true'
run: docker rmi elki_97413/onisep:latest
- name: Build Docker image and Start New Container
run: docker-compose up -d onisep-api