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 13, 2022
1 parent 7d8962c commit e30d2d9
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 @@ -30,6 +30,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 @@ -6,9 +6,6 @@ FROM cirrusci/android-sdk:${android_sdk_ver}
ARG flutter_ver=3.0.2
ARG build_rev=0

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


# Install Flutter
ENV FLUTTER_HOME=/usr/local/flutter \
Expand Down
9 changes: 9 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,21 @@ docker-tags = $(strip $(if $(call eq,$(tags),),\
# [FLUTTER_VER=<android-ndk-version>]
# [BUILD_REV=<build-revision>]

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

docker.image:
docker build --network=host --force-rm \
$(if $(call eq,$(no-cache),yes),--no-cache --pull,) \
--build-arg flutter_ver=$(FLUTTER_VER) \
--build-arg android_sdk_ver=$(ANDROID_SDK_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):$(or $(tag),$(VERSION)) ./


Expand Down

0 comments on commit e30d2d9

Please sign in to comment.