Merge pull request #75 from inkomomutane/inkomomutane-patch-4 #21
This file contains hidden or 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: image build and push | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
image_builder: | |
runs-on: ubuntu-22.04 | |
permissions: | |
packages: write | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v5 | |
- name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKER_HUB_USERNAME }} | |
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} | |
registry: ghcr.io | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Build and push | |
uses: docker/build-push-action@v6 | |
with: | |
context: . | |
platforms: linux/amd64, linux/arm64 | |
push: true | |
tags: ghcr.io/inkomomutane/mimovel:latest | |
deploy_image_to_server: | |
needs: image_builder | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v5 | |
- name: copy docker-compose file to server | |
uses: appleboy/scp-action@v1 | |
with: | |
host: ${{ secrets.PRODUCTION_SSH_REMOTE_HOSTNAME }} | |
username: ${{ secrets.SSH_DEPLOY_USENAME }} | |
key: ${{ secrets.SSH_DEPLOY_PRIVATE_KEY }} | |
source: "docker-compose.prod.yml" | |
target: mimovel | |
- name: initialize ssh and deploy | |
uses: fifsky/ssh-action@master | |
with: | |
command: | | |
cd ~/mimovel | |
docker stack deploy -c docker-compose.prod.yml mimovel | |
host: ${{ secrets.PRODUCTION_SSH_REMOTE_HOSTNAME }} | |
user: ${{ secrets.SSH_DEPLOY_USENAME }} | |
key: ${{ secrets.SSH_DEPLOY_PRIVATE_KEY }} | |
# pass: ${{ secrets.SSH_PASS_KEY }} | |
args: '-tt -vvv' |