refator: update gitmodules #7
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: Prod PR merge | |
on: | |
push: | |
branches: [ "prod" ] | |
env: | |
IMAGE_TAG: $(git rev-parse --short HEAD) | |
jobs: | |
prod-ci: | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
token: ${{ secrets.SUBMODULE_TOKEN }} | |
submodules: true | |
- name: Setup Docker buildx | |
uses: docker/[email protected] | |
- name: Login to Docker Hub | |
uses: docker/[email protected] | |
with: | |
username: ${{ secrets.DOCKER_HUB_USERNAME_PROD }} | |
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN_PROD }} | |
- name: Docker Image Build | |
run: | | |
cd itracker | |
docker build --platform linux/amd64 -t itracker2024/itracker-prod:$IMAGE_TAG -f Dockerfile-prod . | |
- name: Docker Hub Push | |
run: docker push itracker2024/itracker-prod:$IMAGE_TAG | |
prod-cd: | |
needs: prod-ci | |
runs-on: [self-hosted, Linux, prod] | |
steps: | |
- name: Pull Latest Docker Image | |
run: | | |
sudo docker login --username ${{ secrets.DOCKER_HUB_USERNAME_PROD }} --password ${{ secrets.DOCKER_HUB_ACCESS_TOKEN_PROD }} | |
sudo docker pull itracker2024/itracker-prod:$IMAGE_TAG | |
- name: Docker Compose | |
run: | | |
~/backend/deploy.sh | |
docker container prune -f | |
sudo docker image prune -af |