-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
55 lines (43 loc) · 1.16 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
FROM fedora:latest AS build
# Install necessary packages
RUN dnf update -y && \
dnf install -y \
gcc \
gcc-c++ \
cmake \
git \
vtk-devel \
java-latest-openjdk-devel \
python3 && \
dnf clean all
# Set the working directory
WORKDIR /solar-system-stimulation
# Copy the necessary files
COPY data/ ./data/
COPY src/ ./src/
COPY test/ ./test/
COPY CMakeLists.txt .
RUN sed -i '/set(VTK_DIR/c\set(VTK_DIR /usr/lib64/cmake/vtk)' CMakeLists.txt
# Set the build directory
WORKDIR /solar-system-stimulation/build
# Run cmake and build the project
RUN cmake -DCMAKE_BUILD_TYPE=Release .. && \
cmake --build .
# Run tests
RUN ./solar_system_stimulation_test
# Final stage
FROM fedora:latest
# Install necessary runtime libraries
RUN dnf update -y && \
dnf install -y \
libstdc++ \
vtk && \
dnf clean all
# Create a user and group
RUN groupadd -r sim && useradd -r -g sim sim
USER sim
# Copy the built application and data
COPY --chown=sim:sim --from=build /solar-system-stimulation/build /app
COPY --chown=sim:sim --from=build /solar-system-stimulation/data /data
# Set the entrypoint
ENTRYPOINT [ "/app/solar_system_stimulation" ]