Skip to content

Commit

Permalink
Add frontend
Browse files Browse the repository at this point in the history
  • Loading branch information
alexpro2022 committed Mar 19, 2024
1 parent 2af901e commit 2ba2c4f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 12 deletions.
19 changes: 8 additions & 11 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
name: CI/CD
on:
push:
branches: ["develop"]
pull_request:
branches: ["develop"]
workflow_dispatch:
on: [push]

jobs:

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
7 changes: 6 additions & 1 deletion docker/server.docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -23,5 +23,10 @@ services:
env_file:
- ./.env

frontend:
image: "${DOCKERHUB_USERNAME}/${PROJECT_NAME}_frontend"
ports:
- 3000:3000

volumes:
db_data:

0 comments on commit 2ba2c4f

Please sign in to comment.