docker: added OCI-compatible image labels
See https://github.com/opencontainers/image-spec/blob/master/annotations.md
This commit is contained in:
parent
91f5a42459
commit
9c04400369
4 changed files with 43 additions and 5 deletions
|
@ -29,3 +29,16 @@ COPY --from=approot / /
|
||||||
|
|
||||||
CMD ["/docker-start.sh"]
|
CMD ["/docker-start.sh"]
|
||||||
VOLUME ["/data"]
|
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"
|
||||||
|
|
|
@ -1,11 +1,16 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
CLOSEST_VER=$(git describe --tags --abbrev=0)
|
CLOSEST_VER=$(git describe --tags --abbrev=0 ${SOURCE_COMMIT})
|
||||||
if git describe --exact-match --abbrev=0 2> /dev/null; then
|
if git describe --exact-match --abbrev=0 ${SOURCE_COMMIT} 2> /dev/null; then
|
||||||
BUILD_INFO="v${CLOSEST_VER}"
|
BUILD_INFO="v${CLOSEST_VER}"
|
||||||
else
|
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
|
fi
|
||||||
|
|
||||||
echo "Using BUILD_INFO=$BUILD_INFO"
|
echo "Using BUILD_INFO=${BUILD_INFO}"
|
||||||
docker build --build-arg BUILD_INFO=$BUILD_INFO -f $DOCKERFILE_PATH -t $IMAGE_NAME .
|
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 .
|
||||||
|
|
|
@ -42,3 +42,16 @@ ENV PORT=${PORT}
|
||||||
EXPOSE ${PORT}
|
EXPOSE ${PORT}
|
||||||
VOLUME ["/data/"]
|
VOLUME ["/data/"]
|
||||||
CMD ["/opt/app/docker-start.sh"]
|
CMD ["/opt/app/docker-start.sh"]
|
||||||
|
|
||||||
|
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"
|
||||||
|
|
7
server/hooks/build
Executable file
7
server/hooks/build
Executable file
|
@ -0,0 +1,7 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
docker build \
|
||||||
|
--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 .
|
Loading…
Reference in a new issue