fix: Usar workflow igual a analiticaNucleo (docker build directo)
All checks were successful
build-and-deploy / build-and-deploy (push) Successful in 7m33s
All checks were successful
build-and-deploy / build-and-deploy (push) Successful in 7m33s
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
name: Build and Deploy
|
||||
name: build-and-deploy
|
||||
|
||||
on:
|
||||
push:
|
||||
@@ -8,50 +8,41 @@ jobs:
|
||||
build-and-deploy:
|
||||
runs-on: docker
|
||||
env:
|
||||
REG: ${{ vars.REGISTRY_URL }}
|
||||
REPO_OWNER: ${{ github.repository_owner }}
|
||||
APP_NAME: ${{ vars.APP_NAME }}
|
||||
APP_DOMAIN: ${{ vars.APP_DOMAIN }}
|
||||
REG: ${{ vars.REGISTRY_URL }}
|
||||
REPO_OWNER: ${{ vars.REPO_OWNER }}
|
||||
POSTGRES_PASSWORD: ${{ secrets.POSTGRES_PASSWORD }}
|
||||
MASTER_API_KEY: ${{ secrets.MASTER_API_KEY }}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: docker/setup-buildx-action@v2
|
||||
- uses: docker/login-action@v2
|
||||
with:
|
||||
registry: ${{ vars.REGISTRY_URL }}
|
||||
username: ${{ secrets.REGISTRY_USERNAME }}
|
||||
password: ${{ secrets.REGISTRY_PASSWORD }}
|
||||
|
||||
- name: Build+push ${{ vars.APP_NAME }}
|
||||
run: |
|
||||
docker build -t $REG/${{ github.repository_owner }}/$APP_NAME:${{ github.sha }} -t $REG/${{ github.repository_owner }}/$APP_NAME:latest .
|
||||
docker push $REG/${{ github.repository_owner }}/$APP_NAME:${{ github.sha }}
|
||||
docker push $REG/${{ github.repository_owner }}/$APP_NAME:latest
|
||||
|
||||
- name: Info about environment
|
||||
run: |
|
||||
echo "Building ${{ vars.APP_NAME }}"
|
||||
echo "ℹ️ Deploying ${{ vars.APP_NAME }}"
|
||||
echo " Domain: ${{ vars.APP_DOMAIN }}"
|
||||
echo "Registry: ${{ vars.REGISTRY_URL }}"
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Login to Registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ${{ vars.REGISTRY_URL }}
|
||||
username: ${{ secrets.REGISTRY_USER }}
|
||||
password: ${{ secrets.REGISTRY_PASSWORD }}
|
||||
|
||||
- name: Build and push image
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: .
|
||||
push: true
|
||||
tags: |
|
||||
${{ vars.REGISTRY_URL }}/${{ vars.REPO_OWNER }}/${{ vars.APP_NAME }}:latest
|
||||
${{ vars.REGISTRY_URL }}/${{ vars.REPO_OWNER }}/${{ vars.APP_NAME }}:${{ github.sha }}
|
||||
cache-from: type=registry,ref=${{ vars.REGISTRY_URL }}/${{ vars.REPO_OWNER }}/${{ vars.APP_NAME }}:buildcache
|
||||
cache-to: type=registry,ref=${{ vars.REGISTRY_URL }}/${{ vars.REPO_OWNER }}/${{ vars.APP_NAME }}:buildcache,mode=max
|
||||
echo " Image: ${{ vars.REGISTRY_URL }}/${{ github.repository_owner }}/${{ vars.APP_NAME }}:latest"
|
||||
|
||||
- name: Pull fresh images
|
||||
run: docker compose pull
|
||||
|
||||
- name: Stop existing stack
|
||||
- name: Clean up stack
|
||||
run: docker compose --project-name $APP_NAME down --remove-orphans || true
|
||||
|
||||
- name: Start new stack
|
||||
- name: Update stack
|
||||
run: docker compose --project-name $APP_NAME up -d --wait
|
||||
|
||||
- name: Health check
|
||||
|
||||
Reference in New Issue
Block a user