twigs/Dockerfile
William Brawner d80ade5ef6 Attempt to reduce memory usage in Docker
Signed-off-by: William Brawner <me@wbrawner.com>
2019-12-22 17:19:21 -06:00

18 lines
730 B
Docker

FROM openjdk:8-jdk as builder
MAINTAINER Billy Brawner <billy@wbrawner.com>
RUN groupadd --system --gid 1000 maven \
&& useradd --system --gid maven --uid 1000 --shell /bin/bash --create-home maven \
&& mkdir /home/maven/.m2 \
&& chown --recursive maven:maven /home/maven \
&& ln -s /home/maven/.m2 /root/.m2
COPY --chown=maven:maven . /home/maven/src
WORKDIR /home/maven/src
RUN /home/maven/src/mvnw -DskipTests package
FROM openjdk:8-jdk-slim
EXPOSE 8080
COPY --from=builder /home/maven/src/target/budget-api.jar budget-api.jar
ENTRYPOINT ["/usr/local/openjdk-8/bin/java", "-XX:+UnlockExperimentalVMOptions", "-XX:+UseCGroupMemoryLimitForHeap", "-XX:MaxRAMFraction=1", "-Xmx256m", "-jar", "/budget-api.jar"]