-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
36 lines (25 loc) · 965 Bytes
/
Dockerfile
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
# Base image for Maven build
FROM maven:3.8.3-openjdk-17 AS builder
# Set the working directory inside the container
WORKDIR /evolver
# Copy the Maven project file(s) to the container
COPY pom.xml .
# Download project dependencies (cached by Docker layer)
RUN mvn dependency:go-offline -B
# Copy the source code to the container
COPY src/ ./src/
# Build the Maven project
RUN mvn package
# Barebones Java 17 image to run the JAR
FROM eclipse-temurin:17
# Set the working directory inside the container
WORKDIR /evolver
# Copy the JAR file from the builder stage
COPY --from=builder /evolver/target/Evolver-1.0-jar-with-dependencies.jar .
# Copy the resources folder
COPY resources/ ./resources/
# Set the entrypoint script
RUN echo '#!/bin/sh\njava -cp Evolver-1.0-jar-with-dependencies.jar "$@"' > ./docker-entrypoint.sh
RUN chmod +x ./docker-entrypoint.sh
# Specify the command to execute when the container starts
ENTRYPOINT ["./docker-entrypoint.sh"]