blob: 23fed685a60e37f0ad056e63250f9324f9e44c2f (
plain) (
blame)
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
|
FROM quay.io/centos/centos:stream9
# Declare build-time environment
ARG DIST_VERSION={{ conda.installer_version }}
ARG DIST_PLATFORM={{ conda.installer_platform }}
ARG DIST_ARCH={{ conda.installer_arch }}
ARG DIST_URL=https://github.com/conda-forge/miniforge/releases/download/${DIST_VERSION}
# Conda root
ARG CONDA_PACKAGES
# Pipeline environment snapshot definition
ARG SNAPSHOT_INPUT
ARG SNAPSHOT_PKGDIR
# Declare environment
ENV OPT=/opt \
HOME=/home/developer
ENV PYTHONUNBUFFERED=1 \
DIST_VERSION=${DIST_VERSION} \
DIST_PLATFORM=${DIST_PLATFORM} \
DIST_ARCH=${DIST_ARCH} \
DIST_URL=${DIST_URL} \
DIST_INSTALLER={{ conda.installer_name }}-${DIST_VERSION}-${DIST_PLATFORM}-${DIST_ARCH}.sh \
DIST_PATH=${OPT}/conda \
CONDA_PACKAGES=${CONDA_PACKAGES}
# Toolchain
RUN yum update -y \
&& yum install -y \
bzip2-devel \
gcc \
gcc-c++ \
gcc-gfortran \
git \
glibc-devel.i686 \
glibc-devel \
kernel-devel \
libX11-devel \
mesa-libGL \
mesa-libGLU \
ncurses-devel \
subversion \
sudo \
wget \
zlib-devel \
&& yum clean all
# Create 'developer' user
# Configure sudoers
RUN groupadd developer \
&& useradd -g developer -m -d $HOME -s /bin/bash developer \
&& echo "developer:developer" | chpasswd \
&& echo "developer ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
# Install Miniforge
# Reset permissions
RUN curl -q -OSsL ${DIST_URL}/${DIST_INSTALLER} \
&& bash ${DIST_INSTALLER} -b -p ${DIST_PATH} \
&& rm -rf ${DIST_INSTALLER} \
&& echo source ${DIST_PATH}/etc/profile.d/conda.sh > /etc/profile.d/conda.sh \
&& echo source ${DIST_PATH}/etc/profile.d/mamba.sh > /etc/profile.d/mamba.sh \
&& source /etc/profile.d/conda.sh \
&& source /etc/profile.d/mamba.sh \
&& echo conda activate linux > /etc/profile.d/zconda.sh \
&& chown -R developer: ${OPT} ${HOME}
# Configure Conda
ENV PATH="${DIST_PATH}/bin:${PATH}"
# Get delivery snapshot
ADD ${SNAPSHOT_INPUT} ${HOME}/SNAPSHOT.yml
ADD ${SNAPSHOT_PKGDIR} ${HOME}/packages
RUN chown -R developer: ${HOME}
USER developer
RUN conda config --set auto_update_conda false \
&& conda config --set always_yes true \
&& conda config --set quiet true \
&& conda config --set rollback_enabled false
RUN sed -i -e "s|@CONDA_CHANNEL@|${HOME}/packages/conda|;s|@PIP_ARGUMENTS@|--extra-index-url file://${HOME}/packages/wheels|;" ${HOME}/SNAPSHOT.yml
RUN mamba install \
git \
${CONDA_PACKAGES} \
&& mamba env create -n linux --file ${HOME}/SNAPSHOT.yml \
&& conda clean --all \
&& rm -rf ${HOME}/.cache
WORKDIR ${HOME}
CMD ["/bin/bash"]
|