diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index fb21e05..34c6498 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,10 +1,5 @@ name: CI/CD -on: - push: - branches: ["develop"] - pull_request: - branches: ["develop"] - workflow_dispatch: +on: [push] jobs: @@ -37,18 +32,18 @@ jobs: - name: Check out the repo uses: actions/checkout@v4 - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 + uses: docker/setup-buildx-action@v3 - name: Login to Docker - uses: docker/login-action@v2 + uses: docker/login-action@v3 with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_PASSWORD }} - name: Push to Docker Hub - uses: docker/build-push-action@v4 + uses: docker/build-push-action@v5 with: file: ./docker/dev.Dockerfile push: true - tags: ${{ secrets.DOCKERHUB_USERNAME }}/${{ secrets.PROJECT_NAME }}:latest + tags: ${{ secrets.DOCKERHUB_USERNAME }}/${{ secrets.PROJECT_NAME }}_backend:latest server_environment: runs-on: ubuntu-latest @@ -103,6 +98,8 @@ jobs: script: | cd ${{ secrets.PROJECT_NAME }} sudo docker-compose -f server.docker-compose.yml --env-file .env down - sudo docker rmi ${{ secrets.DOCKERHUB_USERNAME }}/${{ secrets.PROJECT_NAME }} + sudo docker rmi \ + ${{ secrets.DOCKERHUB_USERNAME }}/${{ secrets.PROJECT_NAME }}_frontend \ + ${{ secrets.DOCKERHUB_USERNAME }}/${{ secrets.PROJECT_NAME }}_backend sudo systemctl stop nginx sudo docker-compose -f server.docker-compose.yml --env-file .env up -d --quiet-pull diff --git a/docker/server.docker-compose.yml b/docker/server.docker-compose.yml index b6341cb..368b85a 100644 --- a/docker/server.docker-compose.yml +++ b/docker/server.docker-compose.yml @@ -12,7 +12,7 @@ services: - $DB_PORT:$DB_PORT backend: - image: "${DOCKERHUB_USERNAME}/${PROJECT_NAME}" + image: "${DOCKERHUB_USERNAME}/${PROJECT_NAME}_backend" # command: bash -c "alembic upgrade head && uvicorn app.main:app" command: bash -c "uvicorn app.main:app --host=0.0.0.0" restart: always @@ -23,5 +23,10 @@ services: env_file: - ./.env + frontend: + image: "${DOCKERHUB_USERNAME}/${PROJECT_NAME}_frontend" + ports: + - 3000:3000 + volumes: db_data: