File tree 1 file changed +23
-4
lines changed
1 file changed +23
-4
lines changed Original file line number Diff line number Diff line change @@ -126,13 +126,32 @@ FROM alpine:latest AS symfony_h2-proxy-cert
126
126
127
127
RUN apk add --no-cache openssl
128
128
129
+ # Allow to set server name
130
+ ARG SERVER_NAME="localhost"
131
+ ENV SERVER_NAME=${SERVER_NAME}
132
+
129
133
# Use this self-generated certificate only in dev, IT IS NOT SECURE!
134
+ # create the private key
130
135
RUN openssl genrsa -des3 -passout pass:NotSecure -out server.pass.key 2048
131
- RUN openssl rsa -passin pass:NotSecure -in server.pass.key -out server.key
132
- RUN rm server.pass.key
136
+ RUN openssl rsa -passin pass:NotSecure -in server.pass.key -out server.key \
137
+ && rm server.pass.key
138
+
139
+ # create a request to sign certificate
133
140
RUN openssl req -new -passout pass:NotSecure -key server.key -out server.csr \
134
- -subj '/C=SS/ST=SS/L=Gotham City/O=Symfony/CN=localhost'
135
- RUN openssl x509 -req -sha256 -days 365 -in server.csr -signkey server.key -out server.crt
141
+ -subj "/C=SS/ST=SS/L=Gotham City/O=Symfony/CN=${SERVER_NAME}"
142
+
143
+ # create an extensions configuration file
144
+ RUN set -eux; \
145
+ { \
146
+ echo "[ v3_ca ]" ; \
147
+ echo "subjectAltName = DNS:${SERVER_NAME}" ; \
148
+ echo "extendedKeyUsage = serverAuth" ; \
149
+ } > extfile.cnf
150
+
151
+ # create the signed certificate
152
+ RUN openssl x509 -req -sha256 -extensions v3_ca -extfile extfile.cnf -days 365 \
153
+ -in server.csr -signkey server.key -out server.crt \
154
+ && rm extfile.cnf
136
155
137
156
# ## "h2-proxy" stage
138
157
FROM nginx:${NGINX_VERSION}-alpine AS symfony_h2-proxy
You can’t perform that action at this time.
0 commit comments