Created
June 3, 2018 19:08
-
-
Save simonharrer/d0ee940e0f343d06a9d85ee18ac4de51 to your computer and use it in GitHub Desktop.
Automatically add SSL server certificate to list of trusted certificates during build
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM openjdk:8-jdk-alpine | |
ENV EMAIL_HOSTNAME="smtp.gmail.com" | |
ENV EMAIL_PORT="587" | |
RUN apk add --no-cache openssl | |
RUN openssl s_client -showcerts -connect $EMAIL_HOSTNAME:$EMAIL_PORT -starttls smtp </dev/null 2>/dev/null | openssl x509 -outform DER > my-certificate.der | |
RUN echo yes | $JAVA_HOME/bin/keytool -import -trustcacerts -file my-certificate.der -alias my-certificate -keystore $JAVA_HOME/jre/lib/security/cacerts -storepass changeit |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment