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
1diff --git a/.dockerignore b/.dockerignore
2new file mode 100644
3index 0000000..6358c9e
4--- /dev/null
5+++ b/.dockerignore
6@@ -0,0 +1,4 @@
7+Dockerfile
8+.dockerignore
9+.git
10+**/.*.sw[po]
11diff --git a/Dockerfile b/Dockerfile
12index aea8a42..c206066 100644
13--- a/Dockerfile
14+++ b/Dockerfile
15@@ -5,7 +5,8 @@
16 # -v ${PATH_TO_AWS_CONFIG}:/root/.aws/config:ro \
17 # -v ${PATH_TO_AWS_CREDENTIALS}:/root/.aws/credentials:ro \
18 # localhost/tagger:latest ARGS_TO_tag-images.sh
19-FROM ubuntu:latest as build
20+FROM quay.io/skopeo/stable as skopeo
21+FROM ubuntu:focal as build
22 ENV TZ=UTC
23 RUN apt-get update
24 RUN DEBIAN_FRONTEND=noninteractive apt-get full-upgrade -y
25@@ -17,20 +18,24 @@ RUN DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
26 ca-certificates \
27 unzip \
28 jq \
29- docker.io
30-ADD https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip awscliv2.zip
31+ docker.io \
32+ gpg \
33+ libgpgme11 \
34+ libassuan0
35+RUN curl -fsSL https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip -o awscliv2.zip
36 RUN unzip awscliv2.zip
37 RUN ./aws/install
38 RUN rm -rf ./aws awscliv2.zip
39 COPY . /src
40 RUN mkdir -p /root/.aws
41-RUN . /etc/os-release && curl -O https://packages.microsoft.com/config/ubuntu/$VERSION_ID/packages-microsoft-prod.deb
42-RUN apt-get install -y ./packages-microsoft-prod.deb
43+RUN curl -fsSL https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor >/usr/share/keyrings/microsoft.gpg
44+RUN echo "deb [signed-by=/usr/share/keyrings/microsoft.gpg] https://packages.microsoft.com/repos/azure-cli $(. /etc/os-release && echo $UBUNTU_CODENAME) main" \
45+ >/etc/apt/sources.list.d/azure-cli.list
46 RUN apt-get update
47 RUN apt-get install -y azure-cli
48-RUN rm -f packages-microsoft-prod.deb
49 RUN DEBIAN_FRONTEND=noninteractive apt-get remove --purge --auto-remove -y
50 RUN rm -rf /var/lib/apt/lists/*
51+COPY --from=skopeo /usr/bin/skopeo /usr/bin/skopeo
52 FROM scratch
53 COPY --from=build / /
54 WORKDIR /src
55diff --git a/helpers/validate-args.sh b/helpers/validate-args.sh
56index f5792aa..7d5f7e1 100644
57--- a/helpers/validate-args.sh
58+++ b/helpers/validate-args.sh
59@@ -32,6 +32,10 @@ validate_var ()
60
61 validate_registry ()
62 {
63+ if [[ ${DEBUG_SKIP_VALIDATION:-0} == 1 ]]; then
64+ return 0
65+ fi
66+
67 local registry="$1"
68 local registry_regex
69
70@@ -47,6 +51,10 @@ validate_registry ()
71
72 validate_namespace ()
73 {
74+ if [[ ${DEBUG_SKIP_VALIDATION:-0} == 1 ]]; then
75+ return 0
76+ fi
77+
78 local namespace="$1"
79 local registry_regex=${namespace_registry_regexes[$namespace]}
80

Subscribers

People subscribed via source and target branches