repository-deposit-zenodo/Dockerfile

43 lines
1.5 KiB
Docker
Raw Normal View History

2022-12-13 10:29:22 +01:00
####################################### Build stage #######################################
2024-01-18 15:53:46 +01:00
FROM maven:3.9-eclipse-temurin-21-alpine AS build-stage
ARG MAVEN_ACCOUNT_USR
ARG MAVEN_ACCOUNT_PSW
ARG REVISION
ARG MAVEN_GPG_PASSPHRASE
ARG MAVEN_GPG_KEYNAME
ARG PROFILE
ARG DEV_PROFILE_URL
ENV gpg_keyname=$MAVEN_GPG_KEYNAME
ENV gpg_passphrase=$MAVEN_GPG_PASSPHRASE
ENV server_username=$MAVEN_ACCOUNT_USR
ENV server_password=$MAVEN_ACCOUNT_PSW
COPY pom.xml /build/
COPY core /build/core/
COPY web /build/web/
COPY settings.xml /root/.m2/settings.xml
# COPY keypair.asc /tmp/keypair.asc
RUN rm -f /build/web/src/main/resources/config/app.env
RUN rm -f /build/web/src/main/resources/config/*-dev.yml
# RUN rm -f /build/web/src/main/resources/logging/*.xml
# RUN if [ "$PROFILE" = "ossrh" ]; then \
# gpg --batch --import /tmp/keypair.asc; \
# fi
2022-12-13 08:22:00 +01:00
WORKDIR /build/
2024-01-18 15:53:46 +01:00
COPY . .
RUN mvn -Drevision=${REVISION} -DdevProfileUrl=${DEV_PROFILE_URL} dependency:go-offline
# Build project
RUN mvn -Drevision=${REVISION} -DdevProfileUrl=${DEV_PROFILE_URL} clean package
######################################## Run Stage ########################################
FROM eclipse-temurin:21-jre-alpine
ENV SERVER_PORT=8080
EXPOSE ${SERVER_PORT}
COPY --from=build-stage /build/web/target/repository-deposit-web.jar /app/repository-deposit-web.jar
ENTRYPOINT ["java","-Dspring.config.additional-location=file:/config/","-Dspring.profiles.active=${PROFILE}","-Djava.security.egd=file:/dev/./urandom","-jar","/app/repository-deposit-web.jar"]