diff options
| author | Shyam Sunder | 2019-10-04 18:58:05 -0400 |
|---|---|---|
| committer | Shyam Sunder | 2019-10-04 19:52:57 -0400 |
| commit | 9c044003693a945e8508cb7a5a9829fdb802e2c8 (patch) | |
| tree | 894fab6da7a8f8c52caba034048bbcf17fd378f2 /client | |
| parent | 91f5a4245941ee460580f92bd73fe5e81b6bcfac (diff) | |
docker: added OCI-compatible image labels
See https://github.com/opencontainers/image-spec/blob/master/annotations.md
Diffstat (limited to 'client')
| -rw-r--r-- | client/Dockerfile | 13 | ||||
| -rwxr-xr-x | client/hooks/build | 15 |
2 files changed, 23 insertions, 5 deletions
diff --git a/client/Dockerfile b/client/Dockerfile index 7d07bd9..5f02753 100644 --- a/client/Dockerfile +++ b/client/Dockerfile @@ -29,3 +29,16 @@ COPY --from=approot / / CMD ["/docker-start.sh"] VOLUME ["/data"] + +ARG DOCKER_REPO +ARG BUILD_DATE +ARG SOURCE_COMMIT +LABEL \ + maintainer="" \ + org.opencontainers.image.title="${DOCKER_REPO}" \ + org.opencontainers.image.url="https://github.com/rr-/szurubooru" \ + org.opencontainers.image.documentation="https://github.com/rr-/szurubooru/blob/${SOURCE_COMMIT}/doc/INSTALL.md" \ + org.opencontainers.image.created="${BUILD_DATE}" \ + org.opencontainers.image.source="https://github.com/rr-/szurubooru" \ + org.opencontainers.image.revision="${SOURCE_COMMIT}" \ + org.opencontainers.image.licenses="GPL-3.0" diff --git a/client/hooks/build b/client/hooks/build index b8c2c20..bd8c21a 100755 --- a/client/hooks/build +++ b/client/hooks/build @@ -1,11 +1,16 @@ #!/bin/sh -CLOSEST_VER=$(git describe --tags --abbrev=0) -if git describe --exact-match --abbrev=0 2> /dev/null; then +CLOSEST_VER=$(git describe --tags --abbrev=0 ${SOURCE_COMMIT}) +if git describe --exact-match --abbrev=0 ${SOURCE_COMMIT} 2> /dev/null; then BUILD_INFO="v${CLOSEST_VER}" else - BUILD_INFO="v${CLOSEST_VER}-edge-$(echo $SOURCE_COMMIT | cut -c1-7)" + BUILD_INFO="v${CLOSEST_VER}-edge-$(git rev-parse --short ${SOURCE_COMMIT})" fi -echo "Using BUILD_INFO=$BUILD_INFO" -docker build --build-arg BUILD_INFO=$BUILD_INFO -f $DOCKERFILE_PATH -t $IMAGE_NAME . +echo "Using BUILD_INFO=${BUILD_INFO}" +docker build \ + --build-arg BUILD_INFO \ + --build-arg BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ') \ + --build-arg SOURCE_COMMIT \ + --build-arg DOCKER_REPO \ + -f $DOCKERFILE_PATH -t $IMAGE_NAME . |