Skip to content

Commit 5b8bf78

Browse files
committed
Updated image labels and build script
1 parent bce5259 commit 5b8bf78

File tree

2 files changed

+4
-21
lines changed

2 files changed

+4
-21
lines changed

Dockerfile

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -94,18 +94,6 @@ LABEL netbox.original-tag="" \
9494
netbox.git-branch="" \
9595
netbox.git-ref="" \
9696
netbox.git-url="" \
97-
# See http://label-schema.org/rc1/#build-time-labels
98-
# Also https://microbadger.com/labels
99-
org.label-schema.schema-version="1.0" \
100-
org.label-schema.build-date="" \
101-
org.label-schema.name="NetBox Docker" \
102-
org.label-schema.description="A container based distribution of NetBox, the free and open IPAM and DCIM solution." \
103-
org.label-schema.vendor="The netbox-docker contributors." \
104-
org.label-schema.url="https://github.com/netbox-community/netbox-docker" \
105-
org.label-schema.usage="https://github.com/netbox-community/netbox-docker/wiki" \
106-
org.label-schema.vcs-url="https://github.com/netbox-community/netbox-docker.git" \
107-
org.label-schema.vcs-ref="" \
108-
org.label-schema.version="snapshot" \
10997
# See https://github.com/opencontainers/image-spec/blob/master/annotations.md#pre-defined-annotation-keys
11098
org.opencontainers.image.created="" \
11199
org.opencontainers.image.title="NetBox Docker" \
@@ -117,4 +105,4 @@ LABEL netbox.original-tag="" \
117105
org.opencontainers.image.documentation="https://github.com/netbox-community/netbox-docker/wiki" \
118106
org.opencontainers.image.source="https://github.com/netbox-community/netbox-docker.git" \
119107
org.opencontainers.image.revision="" \
120-
org.opencontainers.image.version="snapshot"
108+
org.opencontainers.image.version=""

build.sh

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -297,8 +297,8 @@ for DOCKER_TARGET in "${DOCKER_TARGETS[@]}"; do
297297
fi
298298
PYTHON_LAST_LAYER=$(get_image_last_layer "${DOCKER_FROM_SPLIT[0]}" "${DOCKER_FROM_SPLIT[1]}")
299299
mapfile -t IMAGES_LAYERS_OLD < <(get_image_layers "${DOCKER_ORG}"/"${DOCKER_REPO}" "${TAG}")
300-
NETBOX_GIT_REF_OLD=$(get_image_label NETBOX_GIT_REF "${DOCKER_ORG}"/"${DOCKER_REPO}" "${TAG}")
301-
GIT_REF_OLD=$(get_image_label org.label-schema.vcs-ref "${DOCKER_ORG}"/"${DOCKER_REPO}" "${TAG}")
300+
NETBOX_GIT_REF_OLD=$(get_image_label netbox.git-ref "${DOCKER_ORG}"/"${DOCKER_REPO}" "${TAG}")
301+
GIT_REF_OLD=$(get_image_label org.opencontainers.image.revision "${DOCKER_ORG}"/"${DOCKER_REPO}" "${TAG}")
302302

303303
if ! printf '%s\n' "${IMAGES_LAYERS_OLD[@]}" | grep -q -P "^${PYTHON_LAST_LAYER}\$"; then
304304
SHOULD_BUILD="true"
@@ -336,16 +336,11 @@ for DOCKER_TARGET in "${DOCKER_TARGETS[@]}"; do
336336
# --label
337337
DOCKER_BUILD_ARGS+=(
338338
--label "netbox.original-tag=${TARGET_DOCKER_TAG_PROJECT}"
339-
340-
--label "org.label-schema.build-date=${BUILD_DATE}"
341339
--label "org.opencontainers.image.created=${BUILD_DATE}"
342-
343-
--label "org.label-schema.version=${PROJECT_VERSION}"
344340
--label "org.opencontainers.image.version=${PROJECT_VERSION}"
345341
)
346342
if [ -d ".git" ]; then
347343
DOCKER_BUILD_ARGS+=(
348-
--label "org.label-schema.vcs-ref=${GIT_REF}"
349344
--label "org.opencontainers.image.revision=${GIT_REF}"
350345
)
351346
fi
@@ -385,7 +380,7 @@ for DOCKER_TARGET in "${DOCKER_TARGETS[@]}"; do
385380
$DRY docker build "${DOCKER_BUILD_ARGS[@]}" .
386381
echo "✅ Finished building the Docker images '${TARGET_DOCKER_TAG_PROJECT}'"
387382
echo "🔎 Inspecting labels on '${TARGET_DOCKER_TAG_PROJECT}'"
388-
$DRY docker inspect "${TARGET_DOCKER_TAG_PROJECT}" --format "{{json .Config.Labels}}"
383+
$DRY docker inspect "${TARGET_DOCKER_TAG_PROJECT}" --format "{{json .Config.Labels}}" | jq
389384
else
390385
echo "Build skipped because sources didn't change"
391386
echo "::set-output name=skipped::true"

0 commit comments

Comments
 (0)