Merge ~virtustom/ubuntu-docker-images/+git/utils:skopeo into ~ubuntu-docker-images/ubuntu-docker-images/+git/utils:main

Proposed by Tomáš Virtus
Status: Rejected
Rejected by: Tomáš Virtus
Proposed branch: ~virtustom/ubuntu-docker-images/+git/utils:skopeo
Merge into: ~ubuntu-docker-images/ubuntu-docker-images/+git/utils:main
Diff against target: 79 lines (+23/-6)
3 files modified
.dockerignore (+4/-0)
Dockerfile (+11/-6)
helpers/validate-args.sh (+8/-0)
Reviewer Review Type Date Requested Status
Canonical Server Pending
Review via email: mp+420556@code.launchpad.net

Commit message

Refactor to use Skopeo

To post a comment you must log in.

Unmerged commits

8635014... by Tomáš Virtus

Skip validation when DEBUG_SKIP_VALIDATION=1

Useful for debugging scripts in test repositories. It's still checked
that the specified image exists in given repository.

1a8704b... by Tomáš Virtus

build: Install skopeo in Dockerfile

It will be used for interaction with registries instead of direct API
calls via curl. Skopeo handles OAuth seamlessly. Install it from
official image[1].

[1] https://github.com/containers/skopeo/blob/main/install.md#container-images

9be5b99... by Tomáš Virtus

build: Fix azure-cli install in Dockerfile

Proper instructions for Ubuntu are at
https://docs.microsoft.com/en-us/cli/azure/install-azure-cli-linux?pivots=apt

922685e... by Tomáš Virtus

build: Dockerfile: Use focal as stable base

Third-party apt repositories may not have packages for latest. Use focal
as base for now until 3rd-party packages for jammy are available. E.g.
azure-cli is not yet available for jammy because jammy moved to libssl3
from libssl1.1.

8eef67f... by Tomáš Virtus

build: Dockerfile: Use curl instead of ADD

ADD prevents caching of subsequent directives; every builds runs from
first ADD directive even if nothing changes. Use curl instead.

4e80dbd... by Tomáš Virtus

build: Add .dockerignore

Ignore Dockerfile so that "COPY . /src" won't invalidate its and
subsequent cached layers when Dockerfile is edited. Also ignore Vim swap
files, .git and .dockerignore itself.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
diff --git a/.dockerignore b/.dockerignore
0new file mode 1006440new file mode 100644
index 0000000..6358c9e
--- /dev/null
+++ b/.dockerignore
@@ -0,0 +1,4 @@
1Dockerfile
2.dockerignore
3.git
4**/.*.sw[po]
diff --git a/Dockerfile b/Dockerfile
index aea8a42..c206066 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -5,7 +5,8 @@
5# -v ${PATH_TO_AWS_CONFIG}:/root/.aws/config:ro \5# -v ${PATH_TO_AWS_CONFIG}:/root/.aws/config:ro \
6# -v ${PATH_TO_AWS_CREDENTIALS}:/root/.aws/credentials:ro \6# -v ${PATH_TO_AWS_CREDENTIALS}:/root/.aws/credentials:ro \
7# localhost/tagger:latest ARGS_TO_tag-images.sh7# localhost/tagger:latest ARGS_TO_tag-images.sh
8FROM ubuntu:latest as build8FROM quay.io/skopeo/stable as skopeo
9FROM ubuntu:focal as build
9ENV TZ=UTC10ENV TZ=UTC
10RUN apt-get update11RUN apt-get update
11RUN DEBIAN_FRONTEND=noninteractive apt-get full-upgrade -y12RUN DEBIAN_FRONTEND=noninteractive apt-get full-upgrade -y
@@ -17,20 +18,24 @@ RUN DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
17 ca-certificates \18 ca-certificates \
18 unzip \19 unzip \
19 jq \20 jq \
20 docker.io21 docker.io \
21ADD https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip awscliv2.zip22 gpg \
23 libgpgme11 \
24 libassuan0
25RUN curl -fsSL https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip -o awscliv2.zip
22RUN unzip awscliv2.zip26RUN unzip awscliv2.zip
23RUN ./aws/install27RUN ./aws/install
24RUN rm -rf ./aws awscliv2.zip28RUN rm -rf ./aws awscliv2.zip
25COPY . /src29COPY . /src
26RUN mkdir -p /root/.aws30RUN mkdir -p /root/.aws
27RUN . /etc/os-release && curl -O https://packages.microsoft.com/config/ubuntu/$VERSION_ID/packages-microsoft-prod.deb31RUN curl -fsSL https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor >/usr/share/keyrings/microsoft.gpg
28RUN apt-get install -y ./packages-microsoft-prod.deb32RUN echo "deb [signed-by=/usr/share/keyrings/microsoft.gpg] https://packages.microsoft.com/repos/azure-cli $(. /etc/os-release && echo $UBUNTU_CODENAME) main" \
33 >/etc/apt/sources.list.d/azure-cli.list
29RUN apt-get update34RUN apt-get update
30RUN apt-get install -y azure-cli35RUN apt-get install -y azure-cli
31RUN rm -f packages-microsoft-prod.deb
32RUN DEBIAN_FRONTEND=noninteractive apt-get remove --purge --auto-remove -y36RUN DEBIAN_FRONTEND=noninteractive apt-get remove --purge --auto-remove -y
33RUN rm -rf /var/lib/apt/lists/*37RUN rm -rf /var/lib/apt/lists/*
38COPY --from=skopeo /usr/bin/skopeo /usr/bin/skopeo
34FROM scratch39FROM scratch
35COPY --from=build / /40COPY --from=build / /
36WORKDIR /src41WORKDIR /src
diff --git a/helpers/validate-args.sh b/helpers/validate-args.sh
index f5792aa..7d5f7e1 100644
--- a/helpers/validate-args.sh
+++ b/helpers/validate-args.sh
@@ -32,6 +32,10 @@ validate_var ()
3232
33validate_registry ()33validate_registry ()
34{34{
35 if [[ ${DEBUG_SKIP_VALIDATION:-0} == 1 ]]; then
36 return 0
37 fi
38
35 local registry="$1"39 local registry="$1"
36 local registry_regex40 local registry_regex
3741
@@ -47,6 +51,10 @@ validate_registry ()
4751
48validate_namespace ()52validate_namespace ()
49{53{
54 if [[ ${DEBUG_SKIP_VALIDATION:-0} == 1 ]]; then
55 return 0
56 fi
57
50 local namespace="$1"58 local namespace="$1"
51 local registry_regex=${namespace_registry_regexes[$namespace]}59 local registry_regex=${namespace_registry_regexes[$namespace]}
5260

Subscribers

People subscribed via source and target branches