Skip to content

Commit

Permalink
Record in metadata which Git revision Docker image was built from
Browse files Browse the repository at this point in the history
- move Docker image labeling to `Makefile`
  • Loading branch information
tyranron committed Jun 10, 2022
1 parent bee57b4 commit 6e5d206
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: docker/setup-buildx-action@v2

- uses: satackey/[email protected]
Expand Down
3 changes: 0 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@ ARG firefox_ver=101.0.1
ARG geckodriver_ver=0.31.0
ARG build_rev=0

LABEL org.opencontainers.image.source="\
https://github.com/instrumentisto/geckodriver-docker-image"


RUN apt-get update \
&& apt-get upgrade -y \
Expand Down
9 changes: 9 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,21 @@ docker-tags = $(strip $(if $(call eq,$(tags),),\
# [GECKODRIVER_VER=<geckodriver-version>]
# [BUILD_REV=<build-revision>]

github_url := $(strip $(or $(GITHUB_SERVER_URL),https://github.com))
github_repo := $(strip $(or $(GITHUB_REPOSITORY),\
instrumentisto/geckodriver-docker-image))

docker.image:
docker build --network=host --force-rm \
$(if $(call eq,$(no-cache),yes),--no-cache --pull,) \
--build-arg firefox_ver=$(FIREFOX_VER) \
--build-arg geckodriver_ver=$(GECKODRIVER_VER) \
--build-arg build_rev=$(BUILD_REV) \
--label org.opencontainers.image.source=$(github_url)/$(github_repo) \
--label org.opencontainers.image.revision=$(strip \
$(shell git show --pretty=format:%H --no-patch)) \
--label org.opencontainers.image.version=$(strip \
$(shell git describe --tags --dirty)) \
-t instrumentisto/$(NAME):$(if $(call eq,$(tag),),$(VERSION),$(tag)) ./


Expand Down

0 comments on commit 6e5d206

Please sign in to comment.