From 7685ed962e177e66ebb4dd2f2490189e1202b95d Mon Sep 17 00:00:00 2001 From: Willy Kloucek Date: Thu, 21 Jan 2021 21:32:18 +0100 Subject: [PATCH 1/4] switch to opencontainers annotation for docker images (https://github.com/opencontainers/image-spec/blob/master/annotations.md) --- .drone.star | 10 +++++++++- ocis/docker/Dockerfile.linux.amd64 | 18 +++++++++++++++--- ocis/docker/Dockerfile.linux.arm | 18 +++++++++++++++--- ocis/docker/Dockerfile.linux.arm64 | 18 +++++++++++++++--- 4 files changed, 54 insertions(+), 10 deletions(-) diff --git a/.drone.star b/.drone.star index 76dcbeefc7..293a1e9ae0 100644 --- a/.drone.star +++ b/.drone.star @@ -688,6 +688,12 @@ def dockerReleases(ctx): return pipelines def dockerRelease(ctx, arch): + build_args = [ + 'REVISION=%s' % (ctx.build.commit), + 'VERSION=%s' % (ctx.build.ref.replace("refs/tags/", "") if ctx.build.event == "tag" else "latest"), + 'CREATED=""', # TODO: add time in RFC 3339 format + ] + return { 'kind': 'pipeline', 'type': 'docker', @@ -709,6 +715,7 @@ def dockerRelease(ctx, arch): 'tags': 'linux-%s' % (arch), 'dockerfile': 'ocis/docker/Dockerfile.linux.%s' % (arch), 'repo': ctx.repo.slug, + 'build_args': build_args, }, 'when': { 'ref': { @@ -733,7 +740,8 @@ def dockerRelease(ctx, arch): 'context': 'ocis', 'auto_tag_suffix': 'linux-%s' % (arch), 'dockerfile': 'ocis/docker/Dockerfile.linux.%s' % (arch), - 'repo': ctx.repo.slug, + 'repo': ctx.build.commit, + 'build_args': build_args, }, 'when': { 'ref': { diff --git a/ocis/docker/Dockerfile.linux.amd64 b/ocis/docker/Dockerfile.linux.amd64 index 59498cabd2..3da328c4dc 100644 --- a/ocis/docker/Dockerfile.linux.amd64 +++ b/ocis/docker/Dockerfile.linux.amd64 @@ -1,5 +1,9 @@ FROM amd64/alpine:3.12 +ARG CREATED="" +ARG VERSION="" +ARG REVISION="" + RUN apk update && \ apk upgrade && \ apk add ca-certificates mailcap && \ @@ -7,9 +11,17 @@ RUN apk update && \ echo 'hosts: files dns' >| /etc/nsswitch.conf LABEL maintainer="ownCloud GmbH " \ - org.label-schema.name="ownCloud Infinite Scale" \ - org.label-schema.vendor="ownCloud GmbH" \ - org.label-schema.schema-version="1.0" + org.opencontainers.image.title="ownCloud Infinite Scale" \ + org.opencontainers.image.vendor="ownCloud GmbH" \ + org.opencontainers.image.authors="ownCloud GmbH" \ + org.opencontainers.image.description="oCIS - ownCloud Infinite Scale is a modern file-sync and share platform" \ + org.opencontainers.image.licenses="Apache-2.0" \ + org.opencontainers.image.documentation="https://owncloud.github.io/ocis.git" \ + org.opencontainers.image.created="${CREATED}" \ + org.opencontainers.image.url="https://hub.docker.com/r/owncloud/ocis" \ + org.opencontainers.image.source="https://github.com/owncloud/ocis" \ + org.opencontainers.image.version="${VERSION}" \ + org.opencontainers.image.revision="${REVISION}" EXPOSE 9200/tcp diff --git a/ocis/docker/Dockerfile.linux.arm b/ocis/docker/Dockerfile.linux.arm index 7825247691..a64c693b70 100644 --- a/ocis/docker/Dockerfile.linux.arm +++ b/ocis/docker/Dockerfile.linux.arm @@ -1,5 +1,9 @@ FROM arm32v6/alpine:3.12 +ARG CREATED="" +ARG VERSION="" +ARG REVISION="" + RUN apk update && \ apk upgrade && \ apk add ca-certificates mailcap && \ @@ -7,9 +11,17 @@ RUN apk update && \ echo 'hosts: files dns' >| /etc/nsswitch.conf LABEL maintainer="ownCloud GmbH " \ - org.label-schema.name="ownCloud Infinite Scale" \ - org.label-schema.vendor="ownCloud GmbH" \ - org.label-schema.schema-version="1.0" + org.opencontainers.image.title="ownCloud Infinite Scale" \ + org.opencontainers.image.vendor="ownCloud GmbH" \ + org.opencontainers.image.authors="ownCloud GmbH" \ + org.opencontainers.image.description="oCIS - ownCloud Infinite Scale is a modern file-sync and share platform" \ + org.opencontainers.image.licenses="Apache-2.0" \ + org.opencontainers.image.documentation="https://owncloud.github.io/ocis.git" \ + org.opencontainers.image.created="${CREATED}" \ + org.opencontainers.image.url="https://hub.docker.com/r/owncloud/ocis" \ + org.opencontainers.image.source="https://github.com/owncloud/ocis" \ + org.opencontainers.image.version="${VERSION}" \ + org.opencontainers.image.revision="${REVISION}" EXPOSE 9200/tcp diff --git a/ocis/docker/Dockerfile.linux.arm64 b/ocis/docker/Dockerfile.linux.arm64 index 2e3afb234c..f355b2cc47 100644 --- a/ocis/docker/Dockerfile.linux.arm64 +++ b/ocis/docker/Dockerfile.linux.arm64 @@ -1,5 +1,9 @@ FROM arm64v8/alpine:3.12 +ARG CREATED="" +ARG VERSION="" +ARG REVISION="" + RUN apk update && \ apk upgrade && \ apk add ca-certificates mailcap && \ @@ -7,9 +11,17 @@ RUN apk update && \ echo 'hosts: files dns' >| /etc/nsswitch.conf LABEL maintainer="ownCloud GmbH " \ - org.label-schema.name="ownCloud Infinite Scale" \ - org.label-schema.vendor="ownCloud GmbH" \ - org.label-schema.schema-version="1.0" + org.opencontainers.image.title="ownCloud Infinite Scale" \ + org.opencontainers.image.vendor="ownCloud GmbH" \ + org.opencontainers.image.authors="ownCloud GmbH" \ + org.opencontainers.image.description="oCIS - ownCloud Infinite Scale is a modern file-sync and share platform" \ + org.opencontainers.image.licenses="Apache-2.0" \ + org.opencontainers.image.documentation="https://owncloud.github.io/ocis.git" \ + org.opencontainers.image.created="${CREATED}" \ + org.opencontainers.image.url="https://hub.docker.com/r/owncloud/ocis" \ + org.opencontainers.image.source="https://github.com/owncloud/ocis" \ + org.opencontainers.image.version="${VERSION}" \ + org.opencontainers.image.revision="${REVISION}" EXPOSE 9200/tcp From f6763be9f04b3b2447cae4d2a0a3d11e8fd57a4d Mon Sep 17 00:00:00 2001 From: Willy Kloucek Date: Tue, 2 Feb 2021 10:56:35 +0100 Subject: [PATCH 2/4] remove CREATED label --- .drone.star | 3 +-- ocis/docker/Dockerfile.linux.amd64 | 2 -- ocis/docker/Dockerfile.linux.arm | 2 -- ocis/docker/Dockerfile.linux.arm64 | 2 -- 4 files changed, 1 insertion(+), 8 deletions(-) diff --git a/.drone.star b/.drone.star index 293a1e9ae0..c76fee7879 100644 --- a/.drone.star +++ b/.drone.star @@ -690,8 +690,7 @@ def dockerReleases(ctx): def dockerRelease(ctx, arch): build_args = [ 'REVISION=%s' % (ctx.build.commit), - 'VERSION=%s' % (ctx.build.ref.replace("refs/tags/", "") if ctx.build.event == "tag" else "latest"), - 'CREATED=""', # TODO: add time in RFC 3339 format + 'VERSION=%s' % (ctx.build.ref.replace("refs/tags/", "") if ctx.build.event == "tag" else "latest") ] return { diff --git a/ocis/docker/Dockerfile.linux.amd64 b/ocis/docker/Dockerfile.linux.amd64 index 3da328c4dc..eadd730497 100644 --- a/ocis/docker/Dockerfile.linux.amd64 +++ b/ocis/docker/Dockerfile.linux.amd64 @@ -1,6 +1,5 @@ FROM amd64/alpine:3.12 -ARG CREATED="" ARG VERSION="" ARG REVISION="" @@ -17,7 +16,6 @@ LABEL maintainer="ownCloud GmbH " \ org.opencontainers.image.description="oCIS - ownCloud Infinite Scale is a modern file-sync and share platform" \ org.opencontainers.image.licenses="Apache-2.0" \ org.opencontainers.image.documentation="https://owncloud.github.io/ocis.git" \ - org.opencontainers.image.created="${CREATED}" \ org.opencontainers.image.url="https://hub.docker.com/r/owncloud/ocis" \ org.opencontainers.image.source="https://github.com/owncloud/ocis" \ org.opencontainers.image.version="${VERSION}" \ diff --git a/ocis/docker/Dockerfile.linux.arm b/ocis/docker/Dockerfile.linux.arm index a64c693b70..3106da2bdc 100644 --- a/ocis/docker/Dockerfile.linux.arm +++ b/ocis/docker/Dockerfile.linux.arm @@ -1,6 +1,5 @@ FROM arm32v6/alpine:3.12 -ARG CREATED="" ARG VERSION="" ARG REVISION="" @@ -17,7 +16,6 @@ LABEL maintainer="ownCloud GmbH " \ org.opencontainers.image.description="oCIS - ownCloud Infinite Scale is a modern file-sync and share platform" \ org.opencontainers.image.licenses="Apache-2.0" \ org.opencontainers.image.documentation="https://owncloud.github.io/ocis.git" \ - org.opencontainers.image.created="${CREATED}" \ org.opencontainers.image.url="https://hub.docker.com/r/owncloud/ocis" \ org.opencontainers.image.source="https://github.com/owncloud/ocis" \ org.opencontainers.image.version="${VERSION}" \ diff --git a/ocis/docker/Dockerfile.linux.arm64 b/ocis/docker/Dockerfile.linux.arm64 index f355b2cc47..f10f5b8f51 100644 --- a/ocis/docker/Dockerfile.linux.arm64 +++ b/ocis/docker/Dockerfile.linux.arm64 @@ -1,6 +1,5 @@ FROM arm64v8/alpine:3.12 -ARG CREATED="" ARG VERSION="" ARG REVISION="" @@ -17,7 +16,6 @@ LABEL maintainer="ownCloud GmbH " \ org.opencontainers.image.description="oCIS - ownCloud Infinite Scale is a modern file-sync and share platform" \ org.opencontainers.image.licenses="Apache-2.0" \ org.opencontainers.image.documentation="https://owncloud.github.io/ocis.git" \ - org.opencontainers.image.created="${CREATED}" \ org.opencontainers.image.url="https://hub.docker.com/r/owncloud/ocis" \ org.opencontainers.image.source="https://github.com/owncloud/ocis" \ org.opencontainers.image.version="${VERSION}" \ From 46a2282e474cad0625a2bdfea491181260736616 Mon Sep 17 00:00:00 2001 From: Willy Kloucek Date: Tue, 2 Feb 2021 11:01:37 +0100 Subject: [PATCH 3/4] add changelog --- changelog/unreleased/opencontainers-labels.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 changelog/unreleased/opencontainers-labels.md diff --git a/changelog/unreleased/opencontainers-labels.md b/changelog/unreleased/opencontainers-labels.md new file mode 100644 index 0000000000..26ab6d20fb --- /dev/null +++ b/changelog/unreleased/opencontainers-labels.md @@ -0,0 +1,5 @@ +Enhancement: Switch to opencontainers annotation scheme + +Switch docker image annotation scheme to org.opencontainers standard because org.label-schema is depreciated. + +https://github.com/owncloud/ocis/pull/1381 From 370cd1c8f65e6d5081fbeb6ccb6c7e09887a6928 Mon Sep 17 00:00:00 2001 From: Willy Kloucek Date: Tue, 2 Feb 2021 11:10:56 +0100 Subject: [PATCH 4/4] fix image.documentation link --- ocis/docker/Dockerfile.linux.amd64 | 2 +- ocis/docker/Dockerfile.linux.arm | 2 +- ocis/docker/Dockerfile.linux.arm64 | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ocis/docker/Dockerfile.linux.amd64 b/ocis/docker/Dockerfile.linux.amd64 index eadd730497..a5919002d2 100644 --- a/ocis/docker/Dockerfile.linux.amd64 +++ b/ocis/docker/Dockerfile.linux.amd64 @@ -15,7 +15,7 @@ LABEL maintainer="ownCloud GmbH " \ org.opencontainers.image.authors="ownCloud GmbH" \ org.opencontainers.image.description="oCIS - ownCloud Infinite Scale is a modern file-sync and share platform" \ org.opencontainers.image.licenses="Apache-2.0" \ - org.opencontainers.image.documentation="https://owncloud.github.io/ocis.git" \ + org.opencontainers.image.documentation="https://github.com/owncloud/ocis" \ org.opencontainers.image.url="https://hub.docker.com/r/owncloud/ocis" \ org.opencontainers.image.source="https://github.com/owncloud/ocis" \ org.opencontainers.image.version="${VERSION}" \ diff --git a/ocis/docker/Dockerfile.linux.arm b/ocis/docker/Dockerfile.linux.arm index 3106da2bdc..4df910624e 100644 --- a/ocis/docker/Dockerfile.linux.arm +++ b/ocis/docker/Dockerfile.linux.arm @@ -15,7 +15,7 @@ LABEL maintainer="ownCloud GmbH " \ org.opencontainers.image.authors="ownCloud GmbH" \ org.opencontainers.image.description="oCIS - ownCloud Infinite Scale is a modern file-sync and share platform" \ org.opencontainers.image.licenses="Apache-2.0" \ - org.opencontainers.image.documentation="https://owncloud.github.io/ocis.git" \ + org.opencontainers.image.documentation="https://github.com/owncloud/ocis" \ org.opencontainers.image.url="https://hub.docker.com/r/owncloud/ocis" \ org.opencontainers.image.source="https://github.com/owncloud/ocis" \ org.opencontainers.image.version="${VERSION}" \ diff --git a/ocis/docker/Dockerfile.linux.arm64 b/ocis/docker/Dockerfile.linux.arm64 index f10f5b8f51..1efa4a0b23 100644 --- a/ocis/docker/Dockerfile.linux.arm64 +++ b/ocis/docker/Dockerfile.linux.arm64 @@ -15,7 +15,7 @@ LABEL maintainer="ownCloud GmbH " \ org.opencontainers.image.authors="ownCloud GmbH" \ org.opencontainers.image.description="oCIS - ownCloud Infinite Scale is a modern file-sync and share platform" \ org.opencontainers.image.licenses="Apache-2.0" \ - org.opencontainers.image.documentation="https://owncloud.github.io/ocis.git" \ + org.opencontainers.image.documentation="https://github.com/owncloud/ocis" \ org.opencontainers.image.url="https://hub.docker.com/r/owncloud/ocis" \ org.opencontainers.image.source="https://github.com/owncloud/ocis" \ org.opencontainers.image.version="${VERSION}" \