Skip to content

Docker

Docker #27

name: Docker
on: workflow_dispatch
env:
REGISTRY: ghcr.io
IMAGE_NAME_UID2: iabtechlab/uid2-tcportal
IMAGE_NAME_EUID: iabtechlab/euid-tcportal
jobs:
build-publish-docker:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Get Package Version
id: version
run: |
echo "::set-output name=package_version::$(cat package.json | jq -r '.version')"
- 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 (UID2)
id: meta-uid2
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME_UID2 }}
tags: |
type=sha,prefix=${{ steps.version.outputs.package_version }}-,format=short
- name: Build and push Docker image (UID2)
uses: docker/build-push-action@v4
with:
context: .
file: Dockerfile_uid2
push: true
#tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:
tags: ${{ steps.meta-uid2.outputs.tags }}
labels: ${{ steps.meta-uid2.outputs.labels }}
- name: Extract metadata (tags, labels) for Docker (EUID)
id: meta-euid
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME_EUID }}
tags: |
type=sha,prefix=${{ steps.version.outputs.package_version }}-,format=short
- name: Build and push Docker image (EUID)
uses: docker/build-push-action@v4
with:
context: .
file: Dockerfile_euid
push: true
#tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:
tags: ${{ steps.meta-euid.outputs.tags }}
labels: ${{ steps.meta-euid.outputs.labels }}