1616 - 2375:2375
1717 options : >-
1818 --privileged
19- --tmpfs /var/lib/docker
2019
2120 # Docker with TLS (secure TCP)
2221 docker-tls :
2726 - 2376:2376
2827 options : >-
2928 --privileged
30- --tmpfs /var/lib/docker
3129 volumes :
32- - /tmp /certs:/certs
30+ - ${{ github.workspace }} /certs:/certs
3331
3432 strategy :
3533 matrix :
@@ -50,28 +48,28 @@ jobs:
5048
5149 - name : Generate TLS certs for Docker
5250 run : |
53- mkdir -p /tmp /certs
51+ mkdir -p ${{ github.workspace }} /certs
5452
5553 # Generate CA key and cert
56- openssl genrsa -out /tmp /certs/ca-key.pem 2048
57- openssl req -x509 -new -nodes -key /tmp/ certs/ca-key.pem -sha256 -days 365 -out /tmp /certs/ca.pem -subj "/CN=docker-ca"
54+ openssl genrsa -out ${{ github.workspace }} /certs/ca-key.pem 2048
55+ openssl req -x509 -new -nodes -key ${{ github.workspace }}/ certs/ca-key.pem -sha256 -days 365 -out ${{ github.workspace }} /certs/ca.pem -subj "/CN=docker-ca"
5856
5957 # Generate server key and CSR
60- openssl genrsa -out /tmp /certs/server-key.pem 2048
61- openssl req -new -key /tmp/ certs/server-key.pem -out /tmp /certs/server.csr -subj "/CN=localhost"
58+ openssl genrsa -out ${{ github.workspace }} /certs/server-key.pem 2048
59+ openssl req -new -key ${{ github.workspace }}/ certs/server-key.pem -out ${{ github.workspace }} /certs/server.csr -subj "/CN=localhost"
6260
6361 # Sign server cert with CA
64- openssl x509 -req -in /tmp/ certs/server.csr -CA /tmp/ certs/ca.pem -CAkey /tmp/ certs/ca-key.pem -CAcreateserial -out /tmp /certs/server-cert.pem -days 365 -sha256
62+ openssl x509 -req -in ${{ github.workspace }}/ certs/server.csr -CA ${{ github.workspace }}/ certs/ca.pem -CAkey ${{ github.workspace }}/ certs/ca-key.pem -CAcreateserial -out ${{ github.workspace }} /certs/server-cert.pem -days 365 -sha256
6563
6664 # Generate client key and CSR
67- openssl genrsa -out /tmp /certs/key.pem 2048
68- openssl req -new -key /tmp/ certs/key.pem -out /tmp /certs/client.csr -subj "/CN=client"
65+ openssl genrsa -out ${{ github.workspace }} /certs/key.pem 2048
66+ openssl req -new -key ${{ github.workspace }}/ certs/key.pem -out ${{ github.workspace }} /certs/client.csr -subj "/CN=client"
6967
7068 # Sign client cert with CA
71- openssl x509 -req -in /tmp/ certs/client.csr -CA /tmp/ certs/ca.pem -CAkey /tmp/ certs/ca-key.pem -CAcreateserial -out /tmp /certs/cert.pem -days 365 -sha256
69+ openssl x509 -req -in ${{ github.workspace }}/ certs/client.csr -CA ${{ github.workspace }}/ certs/ca.pem -CAkey ${{ github.workspace }}/ certs/ca-key.pem -CAcreateserial -out ${{ github.workspace }} /certs/cert.pem -days 365 -sha256
7270
7371 # create pfx
74- openssl pkcs12 -export -out /tmp/ certs/client.pfx -inkey /tmp/ certs/key.pem -in /tmp/ certs/cert.pem -certfile /tmp /certs/ca.pem -passout pass:
72+ openssl pkcs12 -export -out ${{ github.workspace }}/ certs/client.pfx -inkey ${{ github.workspace }}/ certs/key.pem -in ${{ github.workspace }}/ certs/cert.pem -certfile ${{ github.workspace }} /certs/ca.pem -passout pass:
7573
7674 - name : Wait for Docker (no TLS) to be healthy
7775 run : |
9088 run : |
9189 for i in {1..10}; do
9290 if docker --host=tcp://localhost:2376 --tlsverify \
93- --tlscacert=/tmp /certs/ca.pem \
94- --tlscert=/tmp /certs/cert.pem \
95- --tlskey=/tmp /certs/key.pem version; then
91+ --tlscacert=${{ github.workspace }} /certs/ca.pem \
92+ --tlscert=${{ github.workspace }} /certs/cert.pem \
93+ --tlskey=${{ github.workspace }} /certs/key.pem version; then
9694 echo "Docker (TLS) is ready!"
9795 exit 0
9896 fi
0 commit comments