this sample demo for identityserver4 run on docker with self-sign certificate
FROM microsoft/aspnetcore:2.0
ARG source
WORKDIR /app
ENV certPassword pass@word
#Use opnssl to generate a self signed certificate cert.pfx with password
RUN openssl rsa -passin pass:${certPassword} -in server.key -out server.key
RUN openssl req -sha256 -new -key server.key -out server.csr -subj '/CN=localhost'
RUN openssl x509 -req -sha256 -days 365 -in server.csr -signkey server.key -out server.crt
RUN openssl pkcs12 -export -out ./cert.pfx -inkey server.key -in server.crt -certfile server.crt -passout pass:${certPassword}
#Expose port 443 for the application.
EXPOSE 443
COPY ${source:-obj/Docker/publish} .
ENTRYPOINT ["dotnet", "QuickstartIdentityServer.dll"]