-
-
Save andfilipe1/47ded652f612ac3f4b08b0d3a35503c9 to your computer and use it in GitHub Desktop.
This file contains 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
# | |
# NOTE: THIS DOCKERFILE IS GENERATED VIA "update.sh" | |
# | |
# PLEASE DO NOT EDIT IT DIRECTLY. | |
# | |
FROM buildpack-deps:stretch-scm | |
# A few reasons for installing distribution-provided OpenJDK: | |
# | |
# 1. Oracle. Licensing prevents us from redistributing the official JDK. | |
# | |
# 2. Compiling OpenJDK also requires the JDK to be installed, and it gets | |
# really hairy. | |
# | |
# For some sample build times, see Debian's buildd logs: | |
# https://buildd.debian.org/status/logs.php?pkg=openjdk-8 | |
RUN apt-get update && apt-get install -y --no-install-recommends \ | |
bzip2 \ | |
unzip \ | |
xz-utils \ | |
git \ | |
&& rm -rf /var/lib/apt/lists/* | |
# Default to UTF-8 file.encoding | |
ENV LANG C.UTF-8 | |
# add a simple script that can auto-detect the appropriate JAVA_HOME value | |
# based on whether the JDK or only the JRE is installed | |
RUN { \ | |
echo '#!/bin/sh'; \ | |
echo 'set -e'; \ | |
echo; \ | |
echo 'dirname "$(dirname "$(readlink -f "$(which javac || which java)")")"'; \ | |
} > /usr/local/bin/docker-java-home \ | |
&& chmod +x /usr/local/bin/docker-java-home | |
# do some fancy footwork to create a JAVA_HOME that's cross-architecture-safe | |
RUN ln -svT "/usr/lib/jvm/java-8-openjdk-$(dpkg --print-architecture)" /docker-java-home | |
ENV JAVA_HOME /docker-java-home | |
ENV JAVA_VERSION 8u162 | |
ENV JAVA_DEBIAN_VERSION 8u162-b12-1~deb9u1 | |
# see https://bugs.debian.org/775775 | |
# and https://github.com/docker-library/java/issues/19#issuecomment-70546872 | |
ENV CA_CERTIFICATES_JAVA_VERSION 20170531+nmu1 | |
RUN set -ex; \ | |
\ | |
# deal with slim variants not having man page directories (which causes "update-alternatives" to fail) | |
if [ ! -d /usr/share/man/man1 ]; then \ | |
mkdir -p /usr/share/man/man1; \ | |
fi; \ | |
\ | |
apt-get update; \ | |
apt-get install -y \ | |
openjdk-8-jdk="$JAVA_DEBIAN_VERSION" \ | |
ca-certificates-java="$CA_CERTIFICATES_JAVA_VERSION" \ | |
; \ | |
rm -rf /var/lib/apt/lists/*; \ | |
\ | |
# verify that "docker-java-home" returns what we expect | |
[ "$(readlink -f "$JAVA_HOME")" = "$(docker-java-home)" ]; \ | |
\ | |
# update-alternatives so that future installs of other OpenJDK versions don't change /usr/bin/java | |
update-alternatives --get-selections | awk -v home="$(readlink -f "$JAVA_HOME")" 'index($3, home) == 1 { $2 = "manual"; print | "update-alternatives --set-selections" }'; \ | |
# ... and verify that it actually worked for one of the alternatives we care about | |
update-alternatives --query java | grep -q 'Status: manual' | |
# see CA_CERTIFICATES_JAVA_VERSION notes above | |
RUN /var/lib/dpkg/info/ca-certificates-java.postinst configure | |
# If you're reading this and have any feedback on how this image could be | |
# improved, please open an issue or a pull request so we can discuss it! | |
# | |
# https://github.com/docker-library/openjdk/issues | |
WORKDIR /opt | |
RUN git clone http://github.com/andfilipe1/api-commons.git \ | |
&& cd /opt/api-commons \ | |
CMD mvn clean install -Dmaven.test.skip=true \ | |
CMD mvn install:install-file -Dfile=/opt/api-tem-commons/target/api-tem-commons-0.0.1-SNAPSHOT.jar -DgroupId=br.com.meutem \ | |
-DartifactId=api-tem-commons -Dversion=0.0.1 -Dpackaging=jar \ | |
mvn clean install -Dmaven.test.skip=true | |
RUN java -version | |
RUN git clone https://github.com/andfilipe1/api-app.git \ | |
&& cd api-app \ | |
CMD mvn clean install -Dmaven.test.skip=true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment