MeshCentral/.github/workflows/docker.yml

68 lines
1.7 KiB
YAML
Raw Normal View History

2022-07-22 11:21:29 -04:00
name: Docker
on:
2023-10-15 20:13:17 -04:00
push:
branches:
- master
2022-07-22 11:21:29 -04:00
release:
types: [published]
2022-07-22 11:21:29 -04:00
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
2022-07-22 11:21:29 -04:00
jobs:
check-token:
runs-on: ubuntu-latest
outputs:
token_defined: ${{ steps.token_check.outputs.token_defined }}
steps:
- name: Check token
id: token_check
env:
MY_TOKEN: ${{ secrets.MY_TOKEN }}
if: "${{ env.MY_TOKEN != '' }}"
run: echo "token_defined=true" >> "$GITHUB_OUTPUT"
2022-07-22 11:21:29 -04:00
build:
name: Release
runs-on: ubuntu-latest
needs: [check-token]
if: needs.check-token.outputs.token_defined == 'true'
2022-07-22 11:21:29 -04:00
steps:
- name: Checkout
uses: actions/checkout@v4
2022-07-22 11:21:29 -04:00
with:
fetch-depth: 0
2022-07-22 11:21:29 -04:00
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
2022-07-22 11:21:29 -04:00
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
2022-07-22 11:21:29 -04:00
- name: Log in to the Container registry
uses: docker/login-action@v3
2022-07-22 11:21:29 -04:00
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.MY_TOKEN }}
2022-07-22 11:21:29 -04:00
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
2022-07-22 11:21:29 -04:00
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
2022-07-22 11:21:29 -04:00
- name: Build and push Docker image
uses: docker/build-push-action@v5
2022-07-22 11:21:29 -04:00
with:
context: .
file: docker/Dockerfile
platforms: linux/amd64,linux/arm64
2022-07-22 11:21:29 -04:00
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
INCLUDE_MONGODBTOOLS=true
PREINSTALL_LIBS=true