-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile-server
46 lines (35 loc) · 1.62 KB
/
Dockerfile-server
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
FROM maven:3.8-eclipse-temurin-17-alpine AS build
WORKDIR /app/common
# Build common module
COPY common/pom.xml .
COPY common/src ./src
RUN mvn install
WORKDIR /app/server
# Download all the dependencies first so we can cache them
# (thank you https://stackoverflow.com/a/71066133)
COPY server/pom.xml .
RUN mvn -Ddocker.build.skip=true -Ddocker.javadoc.skip=true -Ddocker.test.skip=true package test
# Copy the source code, Checkstyle config and data for testing
COPY server/src ./src
COPY server/checkstyle.xml .
COPY server/data ./data
# Adjust application.properties to use the correct hostnames for Docker
RUN apk add --no-cache sed
RUN sed -i 's/server.host=host.docker.internal/server.host=splendor-server/g' src/main/resources/application.properties
RUN sed -i 's/ls.host=localhost/ls.host=lobby-service/g' src/main/resources/application.properties
# Build the application
RUN mvn -Ddocker.test.skip=true package
# Discard Maven, run JAR file using JRE
FROM eclipse-temurin:17-jre-alpine AS runtime
EXPOSE 4243
LABEL org.opencontainers.image.source=https://github.com/COMP361/f2022-hexanome-16
## Download the utility that waits for another container to be ready
ENV WAIT_VERSION 2.7.2
ADD https://github.com/ufoscout/docker-compose-wait/releases/download/$WAIT_VERSION/wait /wait
RUN chmod +x /wait
# Copy the JAR file from the build stage
COPY --from=build /app/server/target/server-0.0.1-SNAPSHOT.jar /app/splendor.jar
#Copy the json files for cards and savegames
COPY server/data /data
# allow debug if startup fails, with: docker run -it --entrypoint /bin/bash splendor-server -s
RUN apk add --no-cache bash coreutils grep sed curl