-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
49 lines (38 loc) · 1.04 KB
/
Dockerfile
File metadata and controls
49 lines (38 loc) · 1.04 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
48
49
FROM ubuntu:22.04 AS builder
# Install build dependencies
RUN apt-get update && apt-get install -y \
build-essential \
cmake \
git \
libomp-dev \
g++-11 \
&& rm -rf /var/lib/apt/lists/*
# Set the default compiler to GCC 11
ENV CC=/usr/bin/gcc-11
ENV CXX=/usr/bin/g++-11
# Create build directory
WORKDIR /app
# Copy source code
COPY . .
# Build the library and executable
RUN mkdir -p build && cd build && \
cmake -DCMAKE_BUILD_TYPE=Release \
-DBUILD_TESTING=OFF .. && \
make -j$(nproc) && \
make install
# Create a smaller runtime image
FROM ubuntu:22.04 AS runtime
# Install runtime dependencies
RUN apt-get update && apt-get install -y \
libomp5 \
&& rm -rf /var/lib/apt/lists/*
# Copy the built executable from builder stage
COPY --from=builder /usr/local/bin/boostedpp /usr/local/bin/
COPY --from=builder /usr/local/lib/libboostedpp.* /usr/local/lib/
# Update dynamic linker
RUN ldconfig
# Set the working directory
WORKDIR /data
# Set the entrypoint
ENTRYPOINT ["boostedpp"]
CMD ["--help"]