Skip to content

Packages 🐳

Packages 🐳 #23

Workflow file for this run

name: 'Packages 🐳'
on:
workflow_dispatch:
push:
branches:
- main
paths:
- build/packages/**
jobs:
build_packages:
name: 'Build ${{ matrix.package }} image & push to ghcr.io 🐳'
runs-on: ubuntu-latest
strategy:
matrix:
include:
- package: postgres
version: 14.8-alpine3.18
- package: rabbitmq
version: 3.11.13-management
permissions:
contents: read
packages: write
env:
REGISTRY: ghcr.io
IMAGE_NAME: 42Atomys/s42-${{ matrix.package }}
IMAGE_TAG: ${{ matrix.version }}
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Log in to the Container registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
github-token: ${{ github.token }}
tags: '${{ env.IMAGE_TAG }}'
labels: |
org.opencontainers.image.title=s42-${{ matrix.package }}
org.opencontainers.image.description=${{ matrix.package }} image for s42 project
org.opencontainers.image.source=https://github.com/42Atomys/stud42/tree/main/build/packages/${{ matrix.package }}
- name: Build and push Docker image
uses: docker/build-push-action@v4
with:
context: build/packages/${{ matrix.package }}
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.labels.outputs.fixed }}
file: build/packages/${{ matrix.package }}/Dockerfile
build-args: |
PACKAGE_VERSION=${{ env.IMAGE_TAG }}