Files
MeshCentral/.github/workflows/docker.yml
2025-09-16 18:41:36 +01:00

111 lines
3.2 KiB
YAML

name: Docker-Builder
on:
workflow_dispatch:
push:
branches:
- master
release:
types: [ published ]
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository || 'MeshCentral' }}
REGISTRY_USERNAME: ${{ github.repository_owner || 'DaanSelen' }}
jobs:
build-images:
name: Build Docker Images
permissions:
packages: write
contents: read
runs-on: ubuntu-latest
strategy:
matrix:
variant:
- name: complete
include_mongodb: true
include_postgresql: true
include_mysql: true
tag_suffix: ""
- name: mongodb
include_mongodb: true
include_postgresql: false
include_mysql: false
tag_suffix: "-mongodb"
- name: postgresql
include_mongodb: false
include_postgresql: true
include_mysql: false
tag_suffix: "-postgresql"
- name: mysql
include_mongodb: false
include_postgresql: false
include_mysql: true
tag_suffix: "-mysql"
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 'lts/*'
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ env.REGISTRY_USERNAME }}
password: ${{ secrets.MY_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
github-token: ${{ secrets.MY_TOKEN }}
env:
DOCKER_METADATA_ANNOTATIONS_LEVELS: manifest,index
- name: Install Translate Packages (allowed to fail)
working-directory: ./translate
run: node translate.js || true
- name: Run extractall
working-directory: ./translate
run: node translate.js extractall
- name: Run minifyall
working-directory: ./translate
run: node translate.js minifyall
- name: Run translateall
working-directory: ./translate
run: node translate.js translateall
- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
context: .
file: docker/Dockerfile
platforms: linux/amd64,linux/arm64,linux/arm/v6,linux/arm/v7
push: true
tags: ${{ steps.meta.outputs.tags }}${{ matrix.variant.tag_suffix }}
labels: ${{ steps.meta.outputs.labels }}
annotations: ${{ steps.meta.outputs.annotations }}
build-args: |
INCLUDE_MONGODB_TOOLS=${{ matrix.variant.include_mongodb }}
INCLUDE_POSTGRESQL_TOOLS=${{ matrix.variant.include_postgresql }}
INCLUDE_MARIADB_TOOLS=${{ matrix.variant.include_mysql }}
DISABLE_MINIFY=yes
DISABLE_TRANSLATE=yes
PREINSTALL_LIBS=true