Update workflow
Some checks failed
Build And Publish / BuildAndPublish (push) Failing after 14s

This commit is contained in:
Ryan Freeman 2024-08-28 15:28:37 +01:00
parent 4a1b7fa6ef
commit 4ead0f781f

View File

@ -19,26 +19,26 @@ jobs:
env: env:
SECRET_PASSPHRASE: ${{ secrets.SECRET_PASSPHRASE }} SECRET_PASSPHRASE: ${{ secrets.SECRET_PASSPHRASE }}
- name: Login to Docker Hub - name: Login to registry
uses: docker/login-action@v3 uses: docker/login-action@v3
with: with:
username: ${{secrets.DOCKER_HUB_USERNAME}} registry: git.ryansnet.xyz
password: ${{secrets.DOCKER_HUB_PASSWORD}} username: ${{secrets.REGISTRY_USERNAME}}
password: ${{secrets.REGISTRY_PASSWORD}}
- name: Set up Docker Buildx - name: Set up Docker Buildx
uses: https://github.com/docker/setup-buildx-action@v3 uses: https://github.com/docker/setup-buildx-action@v3
with: with:
config-inline: | config-inline: |
[registry."docker.io"] [registry."${{secrets.REGISTRY_URL}}"]
mirrors = ["mirror.gcr.io"]
- name: Build and push Docker image - name: Build and tag image
uses: https://github.com/docker/build-push-action@v6 run: |
with: docker build -t ${{secrets.REGISTRY_URL}}/${{secrets.REGISTRY_USERNAME}}/${{secrets.REPO_NAME}}:latest .
context: . # docker tag ${{secrets.REGISTRY_URL}}/${{secrets.REGISTRY_USERNAME}}/${{secrets.REPO_NAME}}:latest ${{secrets.REGISTRY_URL}}/${{secrets.REGISTRY_USERNAME}}/${{secrets.REPO_NAME}}:latest
file: ./Dockerfile
push: true - name: Push image
tags: ${{secrets.DOCKER_HUB_USERNAME}}/${{vars.REPO_NAME}}:v1 run: docker push ${{secrets.REGISTRY_URL}}/${{secrets.REGISTRY_USERNAME}}/${{secrets.REPO_NAME}}:latest
- name: Stop and remove old Docker container - name: Stop and remove old Docker container
continue-on-error: true continue-on-error: true
@ -48,9 +48,9 @@ jobs:
- name: Pull new image and start Docker container - name: Pull new image and start Docker container
run: | run: |
sudo docker pull ${{secrets.DOCKER_HUB_USERNAME}}/${{vars.REPO_NAME}}:v1 sudo docker pull ${{secrets.REGISTRY_URL}}/${{secrets.REGISTRY_USERNAME}}/${{vars.REPO_NAME}}:latest
sudo docker run -d --restart unless-stopped \ sudo docker run -d --restart unless-stopped \
--env-file ./.env \ --env-file ./.env \
--name portfolio \ --name portfolio \
-p ${{vars.DEPLOY_IP}}:3000:3000 \ -p ${{vars.DEPLOY_IP}}:3000:3000 \
${{secrets.DOCKER_HUB_USERNAME}}/${{vars.REPO_NAME}}:v1 ${{secrets.REGISTRY_URL}}/${{secrets.REGISTRY_USERNAME}}/${{vars.REPO_NAME}}:latest