-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
57 lines (48 loc) · 1.87 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
# Dockerfile for Diffraflow project
# maintainer: Zhengheng Li <zhenghenge@gmail.com>
# build ############################################################
# FROM zhenghengli/ubuntu-devel:20.04-cuda11.0.3 AS builder
FROM registry.starlightdf.cc/lizhengheng/docker-ubuntu-devel:20.04-cuda11.0.3 AS builder
# build and install
ARG SOURCE_DIR=/opt/diffraflow_src
ARG BUILD_DIR=/opt/diffraflow_build
ARG INSTALL_DIR=/opt/diffraflow
ADD $PWD $SOURCE_DIR
RUN set -x \
## build and install
&& cmake -S $SOURCE_DIR -B $BUILD_DIR -G Ninja -D CMAKE_BUILD_TYPE=Release \
&& cmake --build $BUILD_DIR --parallel $(nproc) \
&& cmake --install $BUILD_DIR --prefix $INSTALL_DIR \
## clean
&& rm -rf $SOURCE_DIR \
&& rm -rf $BUILD_DIR
# deploy ############################################################
# FROM zhenghengli/ubuntu-runtime:20.04-cuda11.0.3
FROM registry.starlightdf.cc/lizhengheng/docker-ubuntu-runtime:20.04-cuda11.0.3
# copy from builder
ARG INSTALL_DIR=/opt/diffraflow
COPY --from=builder $INSTALL_DIR $INSTALL_DIR
# add labels
ARG SOURCE_COMMIT
ARG COMMIT_MSG
ARG BUILD_TIME
LABEL description="High throughput streaming data acquisition and online analysis for pixel array detectors." \
maintainer="Zhengheng Li <zhenghenge@gmail.com>" \
source_commit="$SOURCE_COMMIT" \
commit_msg="$COMMIT_MSG" \
build_time="$BUILD_TIME"
# set runtime environment variables
ENV PATH=$INSTALL_DIR/bin:$INSTALL_DIR/scripts:$PATH \
LD_LIBRARY_PATH=$INSTALL_DIR/lib:$LD_LIBRARY_PATH \
SOURCE_COMMIT="$SOURCE_COMMIT" \
COMMIT_MSG="$COMMIT_MSG" \
BUILD_TIME="$BUILD_TIME"
# user setting
RUN set -x \
## set root password for runtime debug
&& echo "root:20180427" | chpasswd \
## use a non-root user for normal work
&& groupadd diffraflow --gid=1010 \
&& useradd -m -g diffraflow --uid=1017 diffraflow -s /bin/bash
USER diffraflow
CMD ["/bin/bash"]