ModeratorElection/Dockerfile
2024-07-12 13:14:37 +02:00

41 lines
No EOL
1.2 KiB
Docker

#buildJar-stage
FROM openjdk:22-jdk-slim as build-jar-stage
RUN \
--mount=type=cache,target=/var/cache/apt \
apt-get update && apt-get -qqy upgrade
ADD ./ /usr/local/src/ModeratorElection
WORKDIR /usr/local/src/ModeratorElection/
RUN ./gradlew build -Pvaadin.productionMode
# Run jar stage
FROM build-jar-stage AS run-jar-stage
EXPOSE 8080
WORKDIR /usr/local/src/ModeratorElection/build/libs/
RUN chmod 0740 ./ModeratorElection.jar
ENTRYPOINT ["java", "-jar", "./ModeratorElection.jar"]
FROM build-jar-stage AS ci-image-stage
RUN chmod 0740 ./ModeratorElection.jar
ENTRYPOINT ["java", "-jar", "./ModeratorElection.jar"]
#build-native-stage
FROM ubuntu:latest as build-native-stage
ADD image/resources /tmp
RUN \
--mount=type=cache,target=/var/cache/apt \
/tmp/install.sh
ENV LANG=en_US.UTF-8 \
JAVA_HOME=/usr/lib/jvm/graalvm/bin
# Run native binary stage
FROM build-native-stage AS run-native-stage
EXPOSE 8080
#CMD ["mkdir /usr/local/src/ModeratorElection"]
WORKDIR /usr/local/src/ModeratorElection/build/native/nativeCompile/
##copy native binary
#COPY --from=buildNative-stage /usr/local/src/ModeratorElection/build/native/nativeCompile/ .
RUN chmod 0740 ./ModeratorElection
ENTRYPOINT ["./ModeratorElection"]