This repository was archived by the owner on Apr 22, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathDockerfile
More file actions
44 lines (36 loc) · 1.28 KB
/
Dockerfile
File metadata and controls
44 lines (36 loc) · 1.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
FROM registry:2.6.2
RUN apk add --no-cache openssl
RUN mkdir -p /certs
RUN echo $'[ req ]\n\
default_bits = 2048\n\
distinguished_name = req_distinguished_name\n\
req_extensions = v3_req\n\
[ req_distinguished_name ]\n\
countryName = DE\n\
stateOrProvinceName = TEST\n\
localityName = TEST\n\
organizationName = TEST\n\
commonName = test\n\
[v3_req]\n\
subjectAltName = IP:172.17.0.5\n\
[san_env]\n\
subjectAltName=${ENV::SAN}\n\
' > /certs/conf.cnf
RUN cat /certs/conf.cnf
RUN echo "subjectAltName = IP:172.17.0.5" > /certs/extfile.cnf
ENV REGISTRY_HTTP_TLS_CERTIFICATE=/certs/registry.crt
ENV REGISTRY_HTTP_TLS_KEY=/certs/registry.key
RUN echo $'#!/bin/sh\n\
set -e\n\
IP="$(/sbin/ifconfig | grep "inet addr" | grep -v 127.0.0.1 | cut -d: -f2 | awk \'{print $1}\')"\n\
SAN="IP:$IP" openssl req -newkey rsa:4096 -nodes -sha256 -keyout /certs/registry.key \
-x509 -days 365 -out /certs/registry.crt \
-extensions san_env \
-subj "/C=DE/ST=test/L=test/O=IT/CN=myregistrydomain.com" \
-config /certs/conf.cnf \n\
/entrypoint.sh "$@"\n\
' > /testable-entrypoint.sh
RUN chmod +x /testable-entrypoint.sh
RUN cat /entrypoint.sh
ENTRYPOINT ["/testable-entrypoint.sh"]
CMD ["/etc/docker/registry/config.yml"]