Skip to content

Instantly share code, notes, and snippets.

@pavelgordon
Created September 8, 2020 19:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pavelgordon/a808fd53b2f5c9618c4a928d60ebac18 to your computer and use it in GitHub Desktop.
Save pavelgordon/a808fd53b2f5c9618c4a928d60ebac18 to your computer and use it in GitHub Desktop.
Docker file for Gradle projects(e.g. Ktor). Requires jar file at build/libs/yourapp.jar directory(= run gradle build command before)
FROM openjdk:8-jre-alpine
ENV APPLICATION_USER ktor
RUN adduser -D -g '' $APPLICATION_USER
RUN ls -la
RUN mkdir /app
RUN chown -R $APPLICATION_USER /app
USER $APPLICATION_USER
RUN ls -la
COPY ./build/libs/yourapp.jar /app/yourapp.jar
WORKDIR /app
CMD ["java", "-server", "-XX:+UnlockExperimentalVMOptions", "-XX:+UseCGroupMemoryLimitForHeap", "-XX:InitialRAMFraction=2", "-XX:MinRAMFraction=2", "-XX:MaxRAMFraction=2", "-XX:+UseG1GC", "-XX:MaxGCPauseMillis=100", "-XX:+UseStringDeduplication", "-jar", "yourapp.jar"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment