-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
47 lines (35 loc) · 1.37 KB
/
Dockerfile
File metadata and controls
47 lines (35 loc) · 1.37 KB
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
47
# Use a base image that has Java and Ant installed (name it builder)
FROM openjdk:11-jdk-slim AS builder
# Set environment variables for ANT and IVY versions
ENV ANT_VERSION=1.10.12
ENV IVY_VERSION=2.5.0
# Install Apache Ant
RUN apt-get update && \
apt-get install -y ant && \
apt-get clean
# Set ANT_HOME environment variable
ENV ANT_HOME=/opt/ant
ENV IVY_HOME=/opt/ant/lib
ENV PATH="${PATH}:${ANT_HOME}/bin"
# Set the working directory inside the container
WORKDIR /app
# Copy the build.xml and ivy.xml files into the container. Make sure the build.xml has a target that installs ivy.
COPY build-docker.xml ./build.xml
COPY ivy.xml .
COPY ivysettings.xml .
# Copy the source code into the container
COPY src ./src
# Run Ant to resolve dependencies and build the JAR file
RUN ant -buildfile build.xml init-ivy
RUN ant -buildfile build.xml make
# Use a smaller OpenJDK image for running the application (the name you choose here will be given to the created image)
FROM openjdk:11-jre-slim AS lpm-wonderland
# Set the working directory inside the container
WORKDIR /app
# Copy built JAR file from builder stage (adjust path as necessary)
COPY --from=builder /app/dist/lib ./lib
COPY --from=builder /app/dist/lpm-clustering.jar .
COPY --from=builder /app/dist/lpm-discovery.jar .
COPY --from=builder /app/dist/lpm-distance.jar .
# Command for welcome
# run a script for welcome message