Skip to content

Commit

Permalink
Update Dockerfile to use opencontainers metadata and build-time labels.
Browse files Browse the repository at this point in the history
  • Loading branch information
felddy committed Nov 2, 2020
1 parent 76460df commit 7601051
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 10 deletions.
11 changes: 2 additions & 9 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,18 +1,11 @@
ARG GIT_COMMIT=unspecified
ARG GIT_REMOTE=unspecified
ARG VERSION=unspecified

FROM python:3.9-alpine

ARG GIT_COMMIT
ARG GIT_REMOTE
ARG VERSION

LABEL git_commit=${GIT_COMMIT}
LABEL git_remote=${GIT_REMOTE}
LABEL maintainer="[email protected]"
LABEL vendor="Cyber and Infrastructure Security Agency"
LABEL version=${VERSION}
LABEL org.opencontainers.image.authors="[email protected]"
LABEL org.opencontainers.image.vendor="Cyber and Infrastructure Security Agency"

ARG CISA_UID=421
ENV CISA_HOME="/home/cisa"
Expand Down
2 changes: 1 addition & 1 deletion tests/container_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,5 +89,5 @@ def test_container_version_label_matches(version_container):
exec(f.read(), pkg_vars) # nosec
project_version = pkg_vars["__version__"]
assert (
version_container.labels["version"] == project_version
version_container.labels["org.opencontainers.image.version"] == project_version
), "Dockerfile version label does not match project version"

0 comments on commit 7601051

Please sign in to comment.