69 lines
2.5 KiB
Docker
69 lines
2.5 KiB
Docker
#
|
|
# NOTE: Use the Makefiles to build this image correctly.
|
|
#
|
|
|
|
ARG BASE_IMG=<codeserver>
|
|
FROM $BASE_IMG
|
|
|
|
ARG TARGETARCH
|
|
|
|
USER root
|
|
|
|
# args - software versions
|
|
ARG CODESERVER_PYTHON_VERSION=2023.18.0
|
|
ARG MINIFORGE_VERSION=23.3.1-1
|
|
ARG PIP_VERSION=23.2.1
|
|
ARG PYTHON_VERSION=3.11.6
|
|
|
|
# setup environment for conda
|
|
ENV CONDA_DIR /opt/conda
|
|
ENV PATH "${CONDA_DIR}/bin:${PATH}"
|
|
RUN mkdir -p ${CONDA_DIR} \
|
|
&& echo ". /opt/conda/etc/profile.d/conda.sh" >> ${HOME}/.bashrc \
|
|
&& echo ". /opt/conda/etc/profile.d/conda.sh" >> /etc/profile \
|
|
&& echo "conda activate base" >> ${HOME}/.bashrc \
|
|
&& echo "conda activate base" >> /etc/profile \
|
|
&& chown -R ${NB_USER}:users ${CONDA_DIR} \
|
|
&& chown -R ${NB_USER}:users ${HOME}
|
|
|
|
USER $NB_UID
|
|
|
|
# install - conda, pip, python
|
|
RUN case "${TARGETARCH}" in \
|
|
amd64) MINIFORGE_ARCH="x86_64" ;; \
|
|
arm64) MINIFORGE_ARCH="aarch64" ;; \
|
|
ppc64le) MINIFORGE_ARCH="ppc64le" ;; \
|
|
*) echo "Unsupported architecture: ${TARGETARCH}"; exit 1 ;; \
|
|
esac \
|
|
&& curl -fsSL "https://github.com/conda-forge/miniforge/releases/download/${MINIFORGE_VERSION}/Miniforge3-${MINIFORGE_VERSION}-Linux-${MINIFORGE_ARCH}.sh" -o /tmp/Miniforge3.sh \
|
|
&& curl -fsSL "https://github.com/conda-forge/miniforge/releases/download/${MINIFORGE_VERSION}/Miniforge3-${MINIFORGE_VERSION}-Linux-${MINIFORGE_ARCH}.sh.sha256" -o /tmp/Miniforge3.sh.sha256 \
|
|
&& echo "$(cat /tmp/Miniforge3.sh.sha256 | awk '{ print $1; }') /tmp/Miniforge3.sh" | sha256sum -c - \
|
|
&& rm /tmp/Miniforge3.sh.sha256 \
|
|
&& /bin/bash /tmp/Miniforge3.sh -b -f -p ${CONDA_DIR} \
|
|
&& rm /tmp/Miniforge3.sh \
|
|
&& conda config --system --set auto_update_conda false \
|
|
&& conda config --system --set show_channel_urls true \
|
|
&& echo "conda ${MINIFORGE_VERSION:0:-2}" >> ${CONDA_DIR}/conda-meta/pinned \
|
|
&& echo "python ${PYTHON_VERSION}" >> ${CONDA_DIR}/conda-meta/pinned \
|
|
&& conda install -y -q \
|
|
python=${PYTHON_VERSION} \
|
|
conda=${MINIFORGE_VERSION:0:-2} \
|
|
pip=${PIP_VERSION} \
|
|
&& conda update -y -q --all \
|
|
&& conda clean -a -f -y
|
|
|
|
# install - requirements.txt
|
|
COPY --chown=${NB_USER}:users requirements.txt /tmp
|
|
RUN python3 -m pip install -r /tmp/requirements.txt --quiet --no-cache-dir \
|
|
&& rm -f /tmp/requirements.txt
|
|
|
|
# install - codeserver extensions
|
|
RUN code-server --install-extension "ms-python.python@${CODESERVER_PYTHON_VERSION}" --force \
|
|
&& code-server --list-extensions --show-versions
|
|
|
|
# s6 - 01-copy-tmp-home
|
|
USER root
|
|
RUN mkdir -p /tmp_home \
|
|
&& cp -r ${HOME} /tmp_home \
|
|
&& chown -R ${NB_USER}:users /tmp_home
|
|
USER $NB_UID |