repository-deposit-zenodo/Dockerfile

36 lines
1.3 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 PROFILE
ARG DEV_PROFILE_URL
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
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
2022-12-13 08:22:00 +01:00
WORKDIR /build/
2024-01-19 09:49:24 +01:00
RUN mvn -Drevision=${REVISION} -DdevProfileUrl=${DEV_PROFILE_URL} -P${PROFILE} dependency:go-offline
2024-01-18 15:53:46 +01:00
# Build project
RUN mvn -Drevision=${REVISION} -DdevProfileUrl=${DEV_PROFILE_URL} -P${PROFILE} clean package
2024-01-18 15:53:46 +01:00
######################################## Run Stage ########################################
FROM eclipse-temurin:21-jre-alpine
2024-01-22 10:39:21 +01:00
ARG PROFILE
ARG REVISION
2024-01-18 15:53:46 +01:00
ENV SERVER_PORT=8080
EXPOSE ${SERVER_PORT}
2024-01-22 10:39:21 +01:00
COPY --from=build-stage /build/web/target/repository-deposit-web-${REVISION}.jar /app/repository-deposit-web.jar
2024-01-18 15:53:46 +01:00
2024-01-22 10:39:21 +01:00
ENTRYPOINT ["java","-Dspring.config.additional-location=file:/config/","-Dspring.profiles.active=${PROFILE}","-Djava.security.egd=file:/dev/./urandom","-jar","/app/repository-deposit-web.jar"]