-
Notifications
You must be signed in to change notification settings - Fork 19
/
Dockerfile.cc-ubuntu-skyhook
85 lines (70 loc) · 2.8 KB
/
Dockerfile.cc-ubuntu-skyhook
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
ARG TAG="development"
ARG PROJECT="coffea-casa"
ARG NAME="${PROJECT}/cc-ubuntu"
ARG REGISTRY="hub.opensciencegrid.org"
FROM ${REGISTRY}/${NAME}:${TAG}
# https://github.com/jupyter/docker-stacks/blob/master/base-notebook/Dockerfile
# Fix DL4006
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
USER root
LABEL maintainer="Oksana Shadura <ksu.shadura@gmail.com>"
# Tag
ARG TAG
ARG PROJECT
# Worker image
ARG WORKER_IMAGE="${REGISTRY}/${PROJECT}/cc-analysis-ubuntu"
# Try to see if CEPH_CONF works (https://access.redhat.com/documentation/en-us/red_hat_ceph_storage/1.2.3/html/ceph_configuration_guide/configuration_file_structure)
ARG CEPH_DIR="/opt/ceph"
ARG CEPH_CONF=$CEPH_DIR"/ceph.conf"
# Hack for GH Actions
ARG GITHUB_ACTIONS="false"
ENV CEPH_DIR=$CEPH_DIR
ENV CEPH_CONF=$CEPH_CONF
ENV TAG=$TAG
ENV WORKER_IMAGE=$WORKER_IMAGE
USER root
RUN apt-get update --yes && \
apt-get install --yes --no-install-recommends \
libradospp-dev librados2 rados-objclass-dev python3-rados ceph ceph-mon ceph-osd ceph-mgr ceph-mds ceph-common
# Preparing directories for Dask conf files, patches and job spool directory for HTCondor
RUN mkdir -p ${CEPH_DIR} && chown -R "${NB_USER}:${NB_GID}" ${CEPH_DIR}
USER ${NB_UID}
COPY skyhook/build-skyhook.sh /tmp/
COPY skyhook/.coffea.toml $HOME/
RUN cd /tmp && \
git clone \
--branch arrow-master \
--depth=1 \
https://github.com/uccross/skyhookdm-arrow && \
./build-skyhook.sh
# Skyhook setup: Ceph configuration and Keyring
COPY ceph/ceph.conf ceph/keyring ${CEPH_DIR}/
USER root
#
RUN echo "CEPH_DATA_POOL="cephfs-data0"" >> /etc/enviroment
RUN echo "CEPH_CONFIG_PATH=${CEPH_CONF}" >> /etc/enviroment
# Cleanup
RUN rm -rf /tmp/* \
&& rm -rf $HOME/.cache/.pip/* \
&& mamba clean --all -f -y \
&& jupyter lab clean \
&& jlpm cache clean \
&& npm cache clean --force \
&& find ${CONDA_DIR} -type f -name '*.a' -delete \
&& find ${CONDA_DIR} -type f -name '*.pyc' -delete \
&& find ${CONDA_DIR} -type f -name '*.js.map' -delete \
&& (find ${CONDA_DIR}/lib/python*/site-packages/bokeh/server/static -type f,l -name '*.js' -not -name '*.min.js' -delete || echo "no bokeh static files to cleanup") \
&& rm -rf ${CONDA_DIR}/pkgs
# Fix permissions for Dask/Ceph config files
RUN chown -R "${NB_USER}:${NB_GID}" ${CEPH_DIR}/keyring ${CEPH_DIR}/ceph.conf
# FIXME: done for AGC workshop
ADD prepare-env/prepare-env-cc.sh /usr/local/bin/prepare-env.sh
RUN chmod ugo+x /usr/local/bin/prepare-env.sh
# Switch back to cms-jovyan to avoid accidental container runs as root
USER ${NB_UID}
WORKDIR $HOME
ENTRYPOINT ["tini", "-g", "--", "/usr/local/bin/prepare-env.sh"]
# Extra packages to be installed (apt, pip, conda) and commands to be executed
# Use bash login shell for entrypoint in order
# to automatically source user's .bashrc
CMD ["start-notebook.sh"]