Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add build argument VERSION #69

Merged
merged 2 commits into from
Feb 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ on:
image-tag:
description: Tag name of Docker image
default: 'latest'
ocrd-core-version:
description: Tag of ocrd/core from stage
default: 'latest'

env:
IMAGE_NAME: ghcr.io/${{ github.repository }}
Expand All @@ -32,7 +35,7 @@ jobs:
date -u +"build_date=%Y-%m-%dT%H:%M:%SZ" >> $GITHUB_ENV
LOCAL_VSC_REF=`git rev-parse --short HEAD`
echo "vcs_ref=$LOCAL_VSC_REF" >> $GITHUB_ENV
echo "cache_key=${{ github.event.inputs.image-tag }}-$LOCAL_VSC_REF" >> $GITHUB_ENV # (input image-tag - vcs_ref)
echo "cache_key=${{ github.event.inputs.image-tag }}-${{ github.event.inputs.ocrd-core-version }}-$LOCAL_VSC_REF" >> $GITHUB_ENV # (input image-tag - ocrd-core-version - vcs_ref)
echo "$LOCAL_VSC_REF" > /tmp/${{ github.event.inputs.image-tag }}-vcs-ref # temporary file to fill cache

- name: Get cache key "${{ env.cache_key }}"
Expand Down Expand Up @@ -66,6 +69,7 @@ jobs:
build-args: |
BUILD_DATE=${{ env.build_date }}
VCS_REF=${{ env.vcs_ref }}
VERSION=${{ github.event.inputs.ocrd-core-version }}
cache-from: type=gha
cache-to: type=gha,mode=max

Expand Down
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# github.com/OCR-D/core
# https://hub.docker.com/r/ocrd/core/dockerfile
# ocrd/core # ubuntu:18.04
FROM ocrd/core:latest
ARG VERSION=latest
FROM ocrd/core:$VERSION

ARG VCS_REF
ARG BUILD_DATE
Expand Down
Loading