-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.test
66 lines (60 loc) · 2.64 KB
/
Dockerfile.test
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
ARG VERSION=latest
FROM pqe-rpc-server:${VERSION}
RUN apt-get update && apt-get install --no-install-recommends -yV \
node-json5 \
jq \
wget \
procps \
wait-for-it \
&& rm -rf /var/lib/apt/lists/*
RUN mkdir /ca-certs/
RUN mkdir /certs/
RUN wget https://github.com/msoap/shell2http/releases/download/1.13/shell2http_1.13_amd64.deb
RUN echo "4f41498fd58b9ddb856aef7ef59c267a3cf681a7d576eb9a73a376f5e88e92b2 shell2http_1.13_amd64.deb" | sha256sum --check --status
RUN dpkg -i shell2http_1.13_amd64.deb
RUN json5 -c appsettings.json
RUN mv appsettings.json.json tmp.json
RUN rm appsettings.json
RUN jq -r '.Config.OutputDebugKeys |= "false"' tmp.json > appsettings.json
RUN rm tmp.json
ENV ASPNETCORE_URLS=https://+:443
ENV SERVICE_NAME=localhost
RUN echo '#!/bin/sh\n\
set -x\n\
shell2http /shutdown "kill \$(ps aux | grep '\''[d]otnet IBCQC_NetCore.dll'\'' | awk '\''{print \$2}'\'')" &>/dev/null\n\
openssl req -x509 -new -nodes -keyout /ca-certs/root.key -subj "/C=US/ST=CA/O=IADB/CN=godmode" -sha512 -days 1024 -out /ca-certs/root.crt\n\
cp /ca-certs/root.crt /usr/local/share/ca-certificates/root.crt\n\
update-ca-certificates -v\n\
\n\
printf "[dn]\nCN=$SERVICE_NAME\n[req]\ndistinguished_name = dn\n[EXT]\nsubjectAltName=DNS:$SERVICE_NAME\nkeyUsage=digitalSignature\nextendedKeyUsage=serverAuth" > /server.config\n\
openssl genrsa -out /certs/server.key 2048\n\
openssl req -new -sha512 -key /certs/server.key -subj "/CN=$SERVICE_NAME" -extensions EXT -config /server.config -out /certs/server.csr\n\
openssl x509 -req -in /certs/server.csr -CA /ca-certs/root.crt -CAkey /ca-certs/root.key -CAcreateserial -out /certs/server.crt -days 500 -sha512\n\
\n\
openssl pkcs12 -export -in /certs/server.crt -inkey /certs/server.key -out /app/server.pfx -passout pass:password\n\
cp mailconfig.json temp.json\n\
if [ ! -z ${SMTP_HOST+x} ]; then\n\
jq '\''.Smtp.Host = "'\''$SMTP_HOST'\''"'\'' temp.json > mailconfig.json\n\
cp mailconfig.json temp.json\n\
fi\n\
if [ ! -z ${SMTP_PORT+x} ]; then\n\
jq '\''.Smtp.Port = '\''$SMTP_PORT'\'''\'' temp.json > mailconfig.json\n\
cp mailconfig.json temp.json\n\
fi\n\
if [ ! -z ${SMTP_SSL+x} ]; then\n\
jq '\''.Smtp.Ssl = '\''$SMTP_SSL'\'''\'' temp.json > mailconfig.json\n\
cp mailconfig.json temp.json\n\
fi\n\
if [ ! -z ${SMTP_USER+x} ]; then\n\
jq '\''.Smtp.Username = "'\''$SMTP_USER'\''"'\'' temp.json > mailconfig.json\n\
cp mailconfig.json temp.json\n\
fi\n\
if [ ! -z ${SMTP_PASS+x} ]; then\n\
jq '\''.Smtp.Password = "'\''$SMTP_PASS'\''"'\'' temp.json > mailconfig.json\n\
fi\n\
rm temp.json\n\
dotnet IBCQC_NetCore.dll 443 server.pfx password\n'\
>> /run.sh
RUN chmod +x /run.sh
ENTRYPOINT []
CMD ["/run.sh"]