2025-01-03 15:04:32 +01:00
|
|
|
FROM maven:3-jdk-7 AS build
|
|
|
|
ENV BUILD_UID=1000
|
|
|
|
ENV BUILD=/src
|
|
|
|
ENV MAVEN_HOME=/var/maven
|
|
|
|
RUN mkdir -p $MAVEN_HOME && chown $BUILD_UID $MAVEN_HOME
|
2025-01-03 23:22:55 +01:00
|
|
|
ADD --chown=$BUILD_UID:$BUILD_UID ../legacyworlds-server $BUILD/legacyworlds-server
|
|
|
|
ADD --chown=$BUILD_UID:$BUILD_UID ../legacyworlds-session $BUILD/legacyworlds-session
|
|
|
|
ADD --chown=$BUILD_UID:$BUILD_UID ../legacyworlds-utils $BUILD/legacyworlds-utils
|
|
|
|
ADD --chown=$BUILD_UID:$BUILD_UID ../legacyworlds-web $BUILD/legacyworlds-web
|
|
|
|
ADD --chown=$BUILD_UID:$BUILD_UID pom.xml $BUILD
|
2025-01-03 15:04:32 +01:00
|
|
|
USER $BUILD_UID
|
|
|
|
WORKDIR $BUILD
|
2025-01-03 15:20:34 +01:00
|
|
|
RUN --mount=type=cache,target=$MAVEN_HOME/.m2,uid=$BUILD_UID \
|
|
|
|
mvn -e -Duser.home=$MAVEN_HOME package
|
2025-01-03 15:04:32 +01:00
|
|
|
|
2025-01-03 16:13:34 +01:00
|
|
|
FROM openjdk:7u211-jre-alpine AS backend
|
2025-01-03 15:04:32 +01:00
|
|
|
RUN <<EOF
|
|
|
|
set -e
|
2025-01-03 23:22:25 +01:00
|
|
|
mkdir -p /app/state
|
|
|
|
chown -R 1000 /app/state
|
2025-01-03 15:04:32 +01:00
|
|
|
EOF
|
|
|
|
COPY --from=build /src/legacyworlds-server/legacyworlds-server-main/target/*.jar /app/server.jar
|
|
|
|
COPY --from=build /src/legacyworlds-server/legacyworlds-server-main/target/lib /app/lib
|
2025-01-03 23:22:25 +01:00
|
|
|
COPY --from=build /src/legacyworlds-server/legacyworlds-server-main/data /app/data
|
2025-01-03 15:04:32 +01:00
|
|
|
ADD docker/backend-entrypoint.sh /app/entrypoint.sh
|
2025-01-03 23:22:25 +01:00
|
|
|
VOLUME /app/state
|
2025-01-03 15:04:32 +01:00
|
|
|
ENTRYPOINT ["/app/entrypoint.sh"]
|
|
|
|
CMD ["server"]
|
2025-01-03 16:14:25 +01:00
|
|
|
|
|
|
|
FROM tomcat:6.0-jre7 AS tomcat-base
|
|
|
|
RUN <<EOF
|
|
|
|
rm -rf /usr/local/tomcat/webapps/*
|
|
|
|
adduser --system --no-create-home \
|
|
|
|
--ingroup www-data \
|
|
|
|
--shell /bin/false \
|
|
|
|
--home $CATALINA_HOME \
|
|
|
|
tomcat
|
|
|
|
chown -R tomcat: /usr/local/tomcat
|
|
|
|
EOF
|
|
|
|
USER tomcat
|
|
|
|
|
|
|
|
FROM tomcat-base AS lwmain
|
|
|
|
COPY --from=build \
|
|
|
|
/src/legacyworlds-web/legacyworlds-web-main/target/*.war \
|
|
|
|
$CATALINA_HOME/webapps/ROOT.war
|
|
|
|
|
|
|
|
FROM tomcat-base AS lwadmin
|
|
|
|
COPY --from=build \
|
2025-01-03 23:23:13 +01:00
|
|
|
/src/legacyworlds-web/legacyworlds-web-admin/target/*.war \
|
2025-01-03 16:14:25 +01:00
|
|
|
$CATALINA_HOME/webapps/ROOT.war
|