Skip to content

Build container

Build container #12

Workflow file for this run

---
name: Build container
env:
OWNER: khiopsml
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
# For more details on events that trigger workflows see:
# https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows
on:
schedule:
# Weekly, at 07:00 on Monday UTC time
- cron: "0 7 * * 1"
pull_request:
paths:
- ".github/workflows/docker.yml"
- "Dockerfile"
- "gen/**"
- "go.*"
- "main.go"
- "server/**"
- "statik/**"
- "OpenAPI/**"
push:
branches:
- main
paths:
- ".github/workflows/docker.yml"
- "Dockerfile"
- "gen/**"
- "go.*"
- "main.go"
- "server/**"
- "statik/**"
- "OpenAPI/**"
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
build-and-push-image:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write # to write in the Github package registry
steps:
- name: Checkout khiops-server sources
uses: actions/checkout@v4
- name: Log in to the Container registry
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
- name: Build and push Docker image
uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
- name: Display the image digest
run: echo ${{ steps.docker_build.outputs.digest }}