Skip to content

Instantly share code, notes, and snippets.

@dahoba
Last active August 22, 2019 07:16
Show Gist options
  • Save dahoba/48f15142b011a7507c0ea091aae40b05 to your computer and use it in GitHub Desktop.
Save dahoba/48f15142b011a7507c0ea091aae40b05 to your computer and use it in GitHub Desktop.
Dockerfile Spring boot with maven,tomcat,Sarabun font template
FROM maven:3-jdk-8-slim as builder
ENV JAVA_OPTS=""
ENV MAVEN_OPTS="-XX:+TieredCompilation -XX:TieredStopAtLevel=1"
WORKDIR /server
COPY pom.xml .
RUN mvn -B -fn verify
COPY src ./src
RUN mvn -B -DskipTests verify
#stage 2
FROM tomcat:8-jdk8-adoptopenjdk-hotspot
RUN apt-get update && apt-get install -y unzip fontconfig \
&& curl -q -o "/tmp/sarabun-fonts.zip" -LO https://github.com/dahoba/tomcat-pcks11-proxy/raw/master/8-alpine-fonts/THSarabunNew.zip \
&& unzip /tmp/sarabun-fonts.zip -d /tmp/ \
&& mkdir -p /usr/share/fonts/ \
&& mv /tmp/*.ttf /usr/share/fonts/ \
&& fc-cache -f \
&& apt-get clean autoclean \
&& apt-get autoremove --yes \
&& rm -rf /var/lib/{apt,dpkg,cache,log}/
ENV JAVA_OPTS="-Djava.awt.headless=true -XX:+UseG1GC -Dfile.encoding=UTF-8 -noverify -server"
ENV SPRING_PROFILES_ACTIVE=default
ENV SPRING_APPLICATION_JSON='{}'
RUN rm -rf /usr/local/tomcat/webapps/ROOT /usr/local/tomcat/webapps/docs /usr/local/tomcat/webapps/examples
COPY --from=builder /server/target/api-*.war /usr/local/tomcat/webapps/api.war
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment