-
Notifications
You must be signed in to change notification settings - Fork 12
/
Dockerfile
64 lines (54 loc) · 1.54 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
FROM ubuntu:24.04 AS build
ARG DEPS="\
ca-certificates \
cmake \
make \
g++ \
gemmi \
gemmi-dev \
git \
libboost-program-options-dev \
libeigen3-dev \
libfmt-dev \
libnanoflann-dev \
libomp-dev \
libstb-dev \
nlohmann-json3-dev \
zlib1g-dev \
tao-pegtl-dev"
RUN apt-get update && apt-get install -y --no-install-recommends ${DEPS}
ARG REBUILD=foo
RUN git clone --depth 1 https://github.com/sb-ncbr/ChargeFW2.git && \
cd ChargeFW2 && \
git checkout master && \
mkdir build && \
cd build && \
cmake .. -DCMAKE_INSTALL_PREFIX=. -DPYTHON_MODULE=OFF && \
make -j4 && \
make install
# bundle dependencies
RUN mkdir /dependencies /build
RUN mv /ChargeFW2/build/bin \
/ChargeFW2/build/lib \
/ChargeFW2/build/share \
/build
RUN mv /usr/lib/x86_64-linux-gnu/libgomp.so.1*\
/usr/lib/x86_64-linux-gnu/libfmt.so* \
/usr/lib/x86_64-linux-gnu/libboost_program_options.so* \
/dependencies
FROM ubuntu:24.04 AS app
ENV PATH=/ChargeFW2/build/bin:${PATH}
# copy over the build artifacts
COPY --from=build /build/ /ChargeFW2/build
COPY --from=build /dependencies/* /usr/lib/x86_64-linux-gnu/
# non-root user
ARG UNAME=nonroot
ARG UID=1000
ARG GID=1000
RUN groupadd -g ${GID} -o ${UNAME} && \
useradd -m -u ${UID} -g ${GID} -o -s /bin/bash ${UNAME}
ENV HOME=/home/${UNAME}
USER ${UNAME}
WORKDIR ${HOME}
ENTRYPOINT [ "chargefw2" ]
CMD ["--help"]