Some checks failed
CI Pipeline / changes (push) Has been cancelled
CI Pipeline / core (push) Has been cancelled
CI Pipeline / trading-backend (push) Has been cancelled
CI Pipeline / trading-data-service (push) Has been cancelled
CI Pipeline / trading-frontend (push) Has been cancelled
CI Pipeline / erp-core (push) Has been cancelled
CI Pipeline / erp-mecanicas (push) Has been cancelled
CI Pipeline / gamilit-backend (push) Has been cancelled
CI Pipeline / gamilit-frontend (push) Has been cancelled
195 lines
6.3 KiB
YAML
195 lines
6.3 KiB
YAML
name: Docker Build
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
tags: ['v*']
|
|
workflow_dispatch:
|
|
inputs:
|
|
project:
|
|
description: 'Project to build'
|
|
required: true
|
|
type: choice
|
|
options:
|
|
- all
|
|
- trading-platform
|
|
- erp-suite
|
|
- gamilit
|
|
|
|
env:
|
|
REGISTRY: ghcr.io
|
|
IMAGE_PREFIX: ${{ github.repository_owner }}
|
|
|
|
jobs:
|
|
# =============================================================================
|
|
# Trading Platform Images
|
|
# =============================================================================
|
|
trading-platform:
|
|
if: ${{ github.event.inputs.project == 'all' || github.event.inputs.project == 'trading-platform' || github.event_name == 'push' }}
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: read
|
|
packages: write
|
|
strategy:
|
|
matrix:
|
|
service:
|
|
- name: backend
|
|
context: projects/trading-platform/apps/backend
|
|
dockerfile: Dockerfile
|
|
- name: frontend
|
|
context: projects/trading-platform/apps/frontend
|
|
dockerfile: Dockerfile
|
|
- name: data-service
|
|
context: projects/trading-platform/apps/data-service
|
|
dockerfile: Dockerfile
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- name: Log in to Container Registry
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: ${{ env.REGISTRY }}
|
|
username: ${{ github.actor }}
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Extract metadata
|
|
id: meta
|
|
uses: docker/metadata-action@v5
|
|
with:
|
|
images: ${{ env.REGISTRY }}/${{ env.IMAGE_PREFIX }}/trading-${{ matrix.service.name }}
|
|
tags: |
|
|
type=ref,event=branch
|
|
type=ref,event=pr
|
|
type=semver,pattern={{version}}
|
|
type=sha,prefix=
|
|
|
|
- name: Build and push
|
|
uses: docker/build-push-action@v5
|
|
with:
|
|
context: ${{ matrix.service.context }}
|
|
file: ${{ matrix.service.context }}/${{ matrix.service.dockerfile }}
|
|
push: ${{ github.event_name != 'pull_request' }}
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
labels: ${{ steps.meta.outputs.labels }}
|
|
cache-from: type=gha
|
|
cache-to: type=gha,mode=max
|
|
|
|
# =============================================================================
|
|
# ERP Suite Images
|
|
# =============================================================================
|
|
erp-suite:
|
|
if: ${{ github.event.inputs.project == 'all' || github.event.inputs.project == 'erp-suite' || github.event_name == 'push' }}
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: read
|
|
packages: write
|
|
strategy:
|
|
matrix:
|
|
service:
|
|
- name: erp-core-backend
|
|
context: projects/erp-suite/apps/erp-core/backend
|
|
- name: mecanicas-backend
|
|
context: projects/erp-suite/apps/verticales/mecanicas-diesel/backend
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Check if Dockerfile exists
|
|
id: check
|
|
run: |
|
|
if [ -f "${{ matrix.service.context }}/Dockerfile" ]; then
|
|
echo "exists=true" >> $GITHUB_OUTPUT
|
|
else
|
|
echo "exists=false" >> $GITHUB_OUTPUT
|
|
fi
|
|
|
|
- name: Set up Docker Buildx
|
|
if: steps.check.outputs.exists == 'true'
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- name: Log in to Container Registry
|
|
if: steps.check.outputs.exists == 'true'
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: ${{ env.REGISTRY }}
|
|
username: ${{ github.actor }}
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Extract metadata
|
|
if: steps.check.outputs.exists == 'true'
|
|
id: meta
|
|
uses: docker/metadata-action@v5
|
|
with:
|
|
images: ${{ env.REGISTRY }}/${{ env.IMAGE_PREFIX }}/${{ matrix.service.name }}
|
|
|
|
- name: Build and push
|
|
if: steps.check.outputs.exists == 'true'
|
|
uses: docker/build-push-action@v5
|
|
with:
|
|
context: ${{ matrix.service.context }}
|
|
push: ${{ github.event_name != 'pull_request' }}
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
labels: ${{ steps.meta.outputs.labels }}
|
|
cache-from: type=gha
|
|
cache-to: type=gha,mode=max
|
|
|
|
# =============================================================================
|
|
# Gamilit Images
|
|
# =============================================================================
|
|
gamilit:
|
|
if: ${{ github.event.inputs.project == 'all' || github.event.inputs.project == 'gamilit' || github.event_name == 'push' }}
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: read
|
|
packages: write
|
|
strategy:
|
|
matrix:
|
|
service:
|
|
- name: backend
|
|
context: projects/gamilit/apps/backend
|
|
- name: frontend
|
|
context: projects/gamilit/apps/frontend
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Check if Dockerfile exists
|
|
id: check
|
|
run: |
|
|
if [ -f "${{ matrix.service.context }}/Dockerfile" ]; then
|
|
echo "exists=true" >> $GITHUB_OUTPUT
|
|
else
|
|
echo "exists=false" >> $GITHUB_OUTPUT
|
|
fi
|
|
|
|
- name: Set up Docker Buildx
|
|
if: steps.check.outputs.exists == 'true'
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- name: Log in to Container Registry
|
|
if: steps.check.outputs.exists == 'true'
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: ${{ env.REGISTRY }}
|
|
username: ${{ github.actor }}
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Extract metadata
|
|
if: steps.check.outputs.exists == 'true'
|
|
id: meta
|
|
uses: docker/metadata-action@v5
|
|
with:
|
|
images: ${{ env.REGISTRY }}/${{ env.IMAGE_PREFIX }}/gamilit-${{ matrix.service.name }}
|
|
|
|
- name: Build and push
|
|
if: steps.check.outputs.exists == 'true'
|
|
uses: docker/build-push-action@v5
|
|
with:
|
|
context: ${{ matrix.service.context }}
|
|
push: ${{ github.event_name != 'pull_request' }}
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
labels: ${{ steps.meta.outputs.labels }}
|
|
cache-from: type=gha
|
|
cache-to: type=gha,mode=max
|