55 lines
1.5 KiB
YAML
55 lines
1.5 KiB
YAML
name: Build and Deploy
|
|
|
|
on:
|
|
push:
|
|
branches: [ main ]
|
|
|
|
jobs:
|
|
build-and-push:
|
|
runs-on: self-hosted
|
|
permissions:
|
|
contents: read
|
|
packages: write
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- name: Log in to GitHub Container Registry
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: ghcr.io
|
|
username: ${{ github.actor }}
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Build and push Manager
|
|
uses: docker/build-push-action@v5
|
|
with:
|
|
context: ./manager
|
|
push: true
|
|
# Constrói nativamente apenas para ARM64 na Oracle
|
|
platforms: linux/arm64
|
|
tags: ghcr.io/${{ github.repository }}/edumanager:latest
|
|
|
|
- name: Build and push Portal
|
|
uses: docker/build-push-action@v5
|
|
with:
|
|
context: ./portal
|
|
push: true
|
|
# Constrói nativamente apenas para ARM64 na Oracle
|
|
platforms: linux/arm64
|
|
tags: ghcr.io/${{ github.repository }}/portalaluno:latest
|
|
|
|
- name: Atualizar Containers em Produção (Watchtower)
|
|
run: |
|
|
docker run --rm \
|
|
-e DOCKER_API_VERSION=1.44 \
|
|
-e REPO_USER=${{ github.actor }} \
|
|
-e REPO_PASS=${{ secrets.GITHUB_TOKEN }} \
|
|
-v /var/run/docker.sock:/var/run/docker.sock \
|
|
containrrr/watchtower \
|
|
--run-once --cleanup --debug
|