Last active
June 19, 2019 22:23
-
-
Save jeffersonbezerra/6abe44d57b886c2b19f9a50d8a9ce04d to your computer and use it in GitHub Desktop.
Dockerfile with mvn spotify plugin
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #AZUL/ZULU(Alpine) is compiled in muslm, so it can run directly in alpine | |
| FROM azul/zulu-openjdk-alpine:12.0.1 as generateJreMinimal | |
| #This command creates a partial JRE with a selected set of modules. | |
| RUN jlink \ | |
| --add-modules java.sql,java.naming,java.management,java.instrument,java.security.jgss,java.desktop,jdk.unsupported \ | |
| --verbose \ | |
| --strip-debug \ | |
| --compress 2 \ | |
| --no-header-files \ | |
| --no-man-pages \ | |
| --output /opt/jre-minimal \ | |
| --module-path /opt/java/openjdk/jmods | |
| FROM alpine:3.8 | |
| MAINTAINER Jefferson Bezerra <[email protected]> | |
| #Creates a new user and disables the root | |
| RUN addgroup -g 1000 -S appuser && \ | |
| adduser -u 1000 -S appuser -G appuser && \ | |
| mkdir -p /var/log/fserv && \ | |
| chown appuser:appuser -R /var/log/fserv && chmod 666 /var/log/fserv && \ | |
| sed -i -e 's/^root::/root:!:/' /etc/shadow | |
| USER appuser | |
| COPY --from=generateJreMinimal /opt/jre-minimal /opt/jre-minimal | |
| ENV LANG=C.UTF-8 \ | |
| PATH="$PATH:/opt/jre-minimal/bin:/var/lib/app-configs" | |
| #I used maven-dependency-plugin to unpack the fatjar | |
| COPY --chown=appuser:appuser target/dependency/BOOT-INF/lib /home/appuser/app/lib | |
| COPY --chown=appuser:appuser target/dependency/META-INF /home/appuser/app/META-INF | |
| COPY --chown=appuser:appuser target/dependency/BOOT-INF/classes /home/appuser/app/ | |
| COPY --chown=appuser:appuser target/dependency/BOOT-INF/classes/u63d/ /var/lib/app-configs/u63d/ | |
| WORKDIR /home/appuser/app | |
| VOLUME ["/var/log/appLogFolder"] | |
| EXPOSE 8080 | |
| ENTRYPOINT ["java","-cp",".:./lib/*","com.example.demo.DemoApplication"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.