1
0
mirror of https://github.com/distribution/distribution-library-image synced 2024-11-07 05:05:50 +01:00

Use a single Dockerfile

Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
CrazyMax 2022-01-21 19:26:28 +01:00
parent c0394acc06
commit 6d988746b2
No known key found for this signature in database
GPG Key ID: 3248E46B6BB8C7F7
20 changed files with 32 additions and 323 deletions

32
Dockerfile Normal file

@ -0,0 +1,32 @@
FROM alpine:3.15
RUN apk add --no-cache ca-certificates
RUN set -eux; \
# https://github.com/distribution/distribution/releases
version='2.8.0-beta.1'; \
apkArch="$(apk --print-arch)"; \
case "$apkArch" in \
x86_64) arch='amd64'; sha256='d69d68406a30466070d8e47c21fafaadae5c048239df41b50b28a79fa12945ab' ;; \
aarch64) arch='arm64'; sha256='2a080694ae2528a628245cf5177d4d2e55d430c5dd76cbbf61e5aee08e75abf6' ;; \
armhf) arch='armv6'; sha256='b5092556fd196f59c7d2a8d4e4460c193588d9f7f39d825d17f299d7fc856ca1' ;; \
armv7) arch='armv7'; sha256='f479d7d42a4c6086ee9a51f605386fcfb953198bf9ab48c515ffdde33ad46e5d' ;; \
ppc64le) arch='ppc64le'; sha256='dc0444e672511b4f8dc19fcec1624a33fdaf49a72ff3c1a69bae9bd3399cd074' ;; \
s390x) arch='s390x'; sha256='4b814d1cb60ee7881e59c1ee52635755c2279196861892cface92e58aa6ac749' ;; \
*) echo >&2 "error: unsupported architecture: $apkArch"; exit 1 ;; \
esac; \
wget -O registry.tar.gz "https://github.com/distribution/distribution/releases/download/v${version}/registry_${version}_linux_${arch}.tar.gz"; \
echo "$sha256 *registry.tar.gz" | sha256sum -c -; \
tar --extract --verbose --file registry.tar.gz --directory /bin/ registry; \
rm registry.tar.gz; \
registry --version
COPY ./config-example.yml /etc/docker/registry/config.yml
VOLUME ["/var/lib/registry"]
EXPOSE 5000
COPY docker-entrypoint.sh /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
CMD ["/etc/docker/registry/config.yml"]

@ -1,19 +0,0 @@
FROM alpine:3.14 AS download
RUN apk add --no-cache tar wget
WORKDIR /out
RUN wget -qO- https://github.com/distribution/distribution/releases/download/v2.8.0-beta.1/registry_2.8.0-beta.1_linux_amd64.tar.gz | tar -zxvf - registry
FROM alpine:3.14
RUN set -ex && apk add --no-cache ca-certificates
COPY --from=download /out/registry /bin/registry
COPY ./config-example.yml /etc/docker/registry/config.yml
VOLUME ["/var/lib/registry"]
EXPOSE 5000
COPY docker-entrypoint.sh /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
CMD ["/etc/docker/registry/config.yml"]

@ -1,18 +0,0 @@
version: 0.1
log:
fields:
service: registry
storage:
cache:
blobdescriptor: inmemory
filesystem:
rootdirectory: /var/lib/registry
http:
addr: :5000
headers:
X-Content-Type-Options: [nosniff]
health:
storagedriver:
enabled: true
interval: 10s
threshold: 3

@ -1,10 +0,0 @@
#!/bin/sh
set -e
case "$1" in
*.yaml|*.yml) set -- registry serve "$@" ;;
serve|garbage-collect|help|-*) set -- registry "$@" ;;
esac
exec "$@"

@ -1,19 +0,0 @@
FROM alpine:3.14 AS download
RUN apk add --no-cache tar wget
WORKDIR /out
RUN wget -qO- https://github.com/distribution/distribution/releases/download/v2.8.0-beta.1/registry_2.8.0-beta.1_linux_arm64.tar.gz | tar -zxvf - registry
FROM alpine:3.14
RUN set -ex && apk add --no-cache ca-certificates
COPY --from=download /out/registry /bin/registry
COPY ./config-example.yml /etc/docker/registry/config.yml
VOLUME ["/var/lib/registry"]
EXPOSE 5000
COPY docker-entrypoint.sh /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
CMD ["/etc/docker/registry/config.yml"]

@ -1,18 +0,0 @@
version: 0.1
log:
fields:
service: registry
storage:
cache:
blobdescriptor: inmemory
filesystem:
rootdirectory: /var/lib/registry
http:
addr: :5000
headers:
X-Content-Type-Options: [nosniff]
health:
storagedriver:
enabled: true
interval: 10s
threshold: 3

@ -1,10 +0,0 @@
#!/bin/sh
set -e
case "$1" in
*.yaml|*.yml) set -- registry serve "$@" ;;
serve|garbage-collect|help|-*) set -- registry "$@" ;;
esac
exec "$@"

@ -1,19 +0,0 @@
FROM alpine:3.14 AS download
RUN apk add --no-cache tar wget
WORKDIR /out
RUN wget -qO- https://github.com/distribution/distribution/releases/download/v2.8.0-beta.1/registry_2.8.0-beta.1_linux_armv6.tar.gz | tar -zxvf - registry
FROM alpine:3.14
RUN set -ex && apk add --no-cache ca-certificates
COPY --from=download /out/registry /bin/registry
COPY ./config-example.yml /etc/docker/registry/config.yml
VOLUME ["/var/lib/registry"]
EXPOSE 5000
COPY docker-entrypoint.sh /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
CMD ["/etc/docker/registry/config.yml"]

@ -1,18 +0,0 @@
version: 0.1
log:
fields:
service: registry
storage:
cache:
blobdescriptor: inmemory
filesystem:
rootdirectory: /var/lib/registry
http:
addr: :5000
headers:
X-Content-Type-Options: [nosniff]
health:
storagedriver:
enabled: true
interval: 10s
threshold: 3

@ -1,10 +0,0 @@
#!/bin/sh
set -e
case "$1" in
*.yaml|*.yml) set -- registry serve "$@" ;;
serve|garbage-collect|help|-*) set -- registry "$@" ;;
esac
exec "$@"

@ -1,19 +0,0 @@
FROM alpine:3.14 AS download
RUN apk add --no-cache tar wget
WORKDIR /out
RUN wget -qO- https://github.com/distribution/distribution/releases/download/v2.8.0-beta.1/registry_2.8.0-beta.1_linux_armv7.tar.gz | tar -zxvf - registry
FROM alpine:3.14
RUN set -ex && apk add --no-cache ca-certificates
COPY --from=download /out/registry /bin/registry
COPY ./config-example.yml /etc/docker/registry/config.yml
VOLUME ["/var/lib/registry"]
EXPOSE 5000
COPY docker-entrypoint.sh /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
CMD ["/etc/docker/registry/config.yml"]

@ -1,18 +0,0 @@
version: 0.1
log:
fields:
service: registry
storage:
cache:
blobdescriptor: inmemory
filesystem:
rootdirectory: /var/lib/registry
http:
addr: :5000
headers:
X-Content-Type-Options: [nosniff]
health:
storagedriver:
enabled: true
interval: 10s
threshold: 3

@ -1,10 +0,0 @@
#!/bin/sh
set -e
case "$1" in
*.yaml|*.yml) set -- registry serve "$@" ;;
serve|garbage-collect|help|-*) set -- registry "$@" ;;
esac
exec "$@"

@ -1,19 +0,0 @@
FROM alpine:3.14 AS download
RUN apk add --no-cache tar wget
WORKDIR /out
RUN wget -qO- https://github.com/distribution/distribution/releases/download/v2.8.0-beta.1/registry_2.8.0-beta.1_linux_ppc64le.tar.gz | tar -zxvf - registry
FROM alpine:3.14
RUN set -ex && apk add --no-cache ca-certificates
COPY --from=download /out/registry /bin/registry
COPY ./config-example.yml /etc/docker/registry/config.yml
VOLUME ["/var/lib/registry"]
EXPOSE 5000
COPY docker-entrypoint.sh /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
CMD ["/etc/docker/registry/config.yml"]

@ -1,18 +0,0 @@
version: 0.1
log:
fields:
service: registry
storage:
cache:
blobdescriptor: inmemory
filesystem:
rootdirectory: /var/lib/registry
http:
addr: :5000
headers:
X-Content-Type-Options: [nosniff]
health:
storagedriver:
enabled: true
interval: 10s
threshold: 3

@ -1,10 +0,0 @@
#!/bin/sh
set -e
case "$1" in
*.yaml|*.yml) set -- registry serve "$@" ;;
serve|garbage-collect|help|-*) set -- registry "$@" ;;
esac
exec "$@"

@ -1,19 +0,0 @@
FROM alpine:3.14 AS download
RUN apk add --no-cache tar wget
WORKDIR /out
RUN wget -qO- https://github.com/distribution/distribution/releases/download/v2.8.0-beta.1/registry_2.8.0-beta.1_linux_s390x.tar.gz | tar -zxvf - registry
FROM alpine:3.14
RUN set -ex && apk add --no-cache ca-certificates
COPY --from=download /out/registry /bin/registry
COPY ./config-example.yml /etc/docker/registry/config.yml
VOLUME ["/var/lib/registry"]
EXPOSE 5000
COPY docker-entrypoint.sh /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
CMD ["/etc/docker/registry/config.yml"]

@ -1,18 +0,0 @@
version: 0.1
log:
fields:
service: registry
storage:
cache:
blobdescriptor: inmemory
filesystem:
rootdirectory: /var/lib/registry
http:
addr: :5000
headers:
X-Content-Type-Options: [nosniff]
health:
storagedriver:
enabled: true
interval: 10s
threshold: 3

@ -1,10 +0,0 @@
#!/bin/sh
set -e
case "$1" in
*.yaml|*.yml) set -- registry serve "$@" ;;
serve|garbage-collect|help|-*) set -- registry "$@" ;;
esac
exec "$@"

@ -1,41 +0,0 @@
#!/usr/bin/env bash
: "${ARCHS=amd64,armv6,armv7,arm64,ppc64le,s390x}"
set -e
if [ $# -eq 0 ] ; then
echo "Usage: ./update.sh <distribution/distribution tag or branch>"
exit
fi
VERSION=$1
for arch in ${ARCHS//,/ }; do
echo "Generating distribution dockerfile $VERSION ($arch)..."
mkdir -p "$arch"
cp docker-entrypoint.sh config-example.yml $arch
cat > "$arch/Dockerfile" <<EOF
FROM alpine:3.14 AS download
RUN apk add --no-cache tar wget
WORKDIR /out
RUN wget -qO- https://github.com/distribution/distribution/releases/download/${VERSION}/registry_${VERSION##v}_linux_${arch}.tar.gz | tar -zxvf - registry
FROM alpine:3.14
RUN set -ex && apk add --no-cache ca-certificates
COPY --from=download /out/registry /bin/registry
COPY ./config-example.yml /etc/docker/registry/config.yml
VOLUME ["/var/lib/registry"]
EXPOSE 5000
COPY docker-entrypoint.sh /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
CMD ["/etc/docker/registry/config.yml"]
EOF
done
echo "Done."