-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
68 lines (50 loc) · 1.8 KB
/
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
FROM --platform=linux/amd64 openjdk:21-slim
# Set the environment variable to noninteractive to avoid interactive prompts
ENV DEBIAN_FRONTEND=noninteractive
# Update the package list and upgrade the system without any prompts
RUN apt-get update && apt-get upgrade -y
# Install Maven without any prompts
RUN apt-get install -y maven
WORKDIR /home/user
COPY src ./src
COPY python ./python
COPY local-maven-repo ./local-maven-repo
COPY pom.xml ./pom.xml
RUN mvn clean package || exit
FROM --platform=linux/amd64 openjdk:21-slim
# Set the environment variable to noninteractive to avoid interactive prompts
ENV DEBIAN_FRONTEND=noninteractive
# Update the package list and upgrade the system without any prompts
RUN apt-get update && apt-get upgrade -y
RUN apt-get install bash git python3 unzip curl dos2unix -y
# Install Python and pip
RUN apt-get install -y python3 python3-pip python3-virtualenv
ARG GROUP_ID
ARG USER_ID
RUN if ! getent group $GROUP_ID; then \
groupadd -g $GROUP_ID user; \
fi
RUN useradd --no-create-home --uid $USER_ID --gid $GROUP_ID --home-dir /home/user --shell /bin/bash user
RUN mkdir -p /home/user
RUN chown $USER_ID:$GROUP_ID /home/user
WORKDIR /home/user
# Copy the docker resources
COPY docker/* ./
COPY python ./python
RUN mkdir data
COPY data ./data
COPY setup.sh ./setup.sh
# Patch Windows line endings if the repository was cloned on Windows.
RUN find . -exec dos2unix {} +
# Copy all relevant files from the previous stage
COPY --from=0 /home/user/target* ./
# Set up the python environment for executing the plot creation
WORKDIR /home/user/python
WORKDIR /home/user
# Adjust permissions
RUN chown $USER_ID:$GROUP_ID /home/user -R
RUN chmod +x run-experiments.sh
RUN chmod +x entrypoint.sh
RUN chmod +x setup.sh
ENTRYPOINT ["./entrypoint.sh", "./run-experiments.sh"]
USER user