٩(。•́‿•̀。)۶ #10
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: Publish Docker images | |
on: | |
push: | |
branches: [ main ] | |
jobs: | |
build-and-push: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v1 | |
- name: Login to DockerHub | |
uses: docker/login-action@v1 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Build and push srv image | |
uses: docker/build-push-action@v2 | |
with: | |
context: ./server | |
file: ./server/Dockerfile | |
push: true | |
tags: ${{ secrets.DOCKERHUB_USERNAME }}/cute.converter:gitsrv | |
build-args: | |
SRVNAME=${{ secrets.SRV_HOSTNAME }} | |
- name: Build and push frnt image | |
uses: docker/build-push-action@v2 | |
with: | |
context: ./frontend | |
file: ./frontend/Dockerfile | |
push: true | |
tags: ${{ secrets.DOCKERHUB_USERNAME }}/cute.converter:gitfrnt | |
build-args: | |
VITE_APP_API_URL=${{ secrets.PROTOCOL }}://${{ secrets.SRV_HOSTNAME }} | |
deploy: | |
needs: build-and-push | |
runs-on: self-hosted | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Stop and remove previous deployment | |
run: docker-compose -f docker-compose.prod.yml down --rmi all | |
- name: Deploy to server | |
env: | |
ADDRESS: 0.0.0.0 | |
PORT: ${{ secrets.SRV_PORT }} | |
UNIT: 1 | |
TYPE: 1 | |
PROTOCOL: ${{ secrets.PROTOCOL }} | |
SRV_HOSTNAME: ${{ secrets.SRV_HOSTNAME }} | |
SRV_PORT: ${{ secrets.SRV_PORT }} | |
FRNT_PORT: ${{ secrets.FRNT_PORT }} | |
PROTOCOL_API: ${{ secrets.PROTOCOL_API }} | |
run: | | |
docker pull ${{ secrets.DOCKERHUB_USERNAME }}/cute.converter:gitsrv | |
docker pull ${{ secrets.DOCKERHUB_USERNAME }}/cute.converter:gitfrnt | |
docker-compose -f docker-compose.prod.yml up -d |