personal-page/.forgejo/workflows/build-docker-image.yaml
aleidk bad6dcb592
Some checks failed
Publish image / create-docker-images (push) Successful in 32s
Publish image / deploy (push) Failing after 8s
build: add autodeploy workflow
2024-12-09 10:56:05 -03:00

42 lines
1.2 KiB
YAML

name: Publish image
on:
push:
workflow_dispatch:
jobs:
create-docker-images:
runs-on: host
steps:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
registry: git.alecodes.page
username: ${{ vars.CONTAINER_REGISTRY_USER }}
password: ${{ secrets.CONTAINER_REGISTRY_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v6
with:
platforms: linux/amd64,linux/arm64,linux/arm/v7
push: true
tags: |
git.alecodes.page/alecodes/page:latest
git.alecodes.page/alecodes/page:${{ github.sha }}
deploy:
runs-on: ubuntu-latest
needs:
- create-docker-images
steps:
- name: 'Docker Stack Deploy'
uses: https://github.com/cssnr/stack-deploy-action@v1
with:
host: ${{ vars.DOCKER_SWARM_HOST }}
port: ${{ vars.DOCKER_SWARM_PORT }}
user: ${{ secrets.DOCKER_SWARM_USER }}
ssh_key: '${{ secrets.DOCKER_SWARM_SSH_KEY }}'
file: 'docker-stack.yaml'
name: 'personal-page'