Skip to content

Instantly share code, notes, and snippets.

@jpomykala
Created March 16, 2019 12:27
Show Gist options
  • Save jpomykala/f06bf4635d5c458f73a8299334680613 to your computer and use it in GitHub Desktop.
Save jpomykala/f06bf4635d5c458f73a8299334680613 to your computer and use it in GitHub Desktop.
Dockerfile for Java
FROM openjdk:11-jre-slim
LABEL maintainer="[email protected]"
ENV PATH $PATH:$JAVA_HOME/bin
ENV JAVA_OPTS "-server -XX:+UseG1GC -XX:+UseStringDeduplication -XX:+OptimizeStringConcat -Dsun.net.inetaddr.ttl=60"
ENV HEAP_SPACE "-Xms512m -Xmx2g"
ENV REMOTE_DEBUG "-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:1044"
ENV JMX "-Dcom.sun.management.jmxremote -Djava.rmi.server.hostname=127.0.0.1 -Dcom.sun.management.jmxremote.port=1099 -Dcom.sun.management.jmxremote.local.only=false -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false"
ENV TIME_ZONE UTC
ENV SPRING_PROFILES_ACTIVE live
RUN echo "$TIME_ZONE" > /etc/timezone
RUN dpkg-reconfigure -f noninteractive tzdata
WORKDIR /app
EXPOSE 8080
COPY app.jar /app/app.jar
CMD ["/bin/sh", "-c", "java $HEAP_SPACE $JAVA_OPTS -jar /app/app.jar --spring.profiles.active=$SPRING_PROFILES_ACTIVE"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment