nginx timeout #9
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Deploy app | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
steps: | |
# This step checks out a copy of your repository. | |
- name: check out repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
ref: main | |
- name: Login to docker hub | |
run: echo "${{secrets.DOCKER_PASSWORD}}" | docker login -u ${{secrets.DOCKER_USERNAME}} --password-stdin | |
- name: Build, tag and Push Images | |
run: | | |
REPO=${{secrets.DOCKER_USERNAME}}/macrobimadoption | |
TAG=latest | |
docker build --no-cache -t $REPO:frontend-$TAG --build-arg NEXT_PUBLIC_APP_DOMAIN=${{secrets.NEXT_PUBLIC_APP_DOMAIN}} ./frontend | |
docker build --no-cache -t $REPO:backend-$TAG --build-arg POSTGRES_PRISMA_URL=${{secrets.POSTGRES_PRISMA_URL}} ./backend | |
docker build --no-cache -t $REPO:nginx-$TAG ./proxy | |
docker push $REPO:frontend-$TAG | |
docker push $REPO:backend-$TAG | |
docker push $REPO:nginx-$TAG | |
deploy: | |
needs: build | |
name: Deploy | |
runs-on: self-hosted | |
steps: | |
- name: Checkout compose.yaml file | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
ref: main | |
- name: Create .env file for runtime (deploy) | |
run: | | |
echo "POSTGRES_PRISMA_URL=${{secrets.POSTGRES_PRISMA_URL}}" > ./backend/.env | |
- name: Stop existing containers and remove images | |
run: docker-compose down --rmi all | |
- name: Run container with Docker Compose | |
run: docker-compose up -d |