Last active
September 18, 2018 11:12
-
-
Save weiji14/ded3eb3c5b0810a181f15cbbc8e151a4 to your computer and use it in GitHub Desktop.
Trying to use resurrected `conda run` to run pipenv inside docker
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM buildpack-deps:bionic@sha256:b1cede2fe7fc26d4e2f59e93e67741d142fb87446d748f0667b1158175e1054f | |
LABEL maintainer "https://github.com/weiji14" | |
ENV LANG C.UTF-8 | |
ENV LC_ALL C.UTF-8 | |
# Initiate docker container with user 'jovyan' | |
ENV NB_USER jovyan | |
ENV NB_UID 1000 | |
ENV HOME /home/${NB_USER} | |
RUN adduser --disabled-password \ | |
--gecos "Default user" \ | |
--uid ${NB_UID} \ | |
${NB_USER} | |
# Setup conda | |
ENV CONDA_DIR /opt/conda | |
ENV NB_PYTHON_PREFIX ${CONDA_DIR} | |
ENV MINICONDA_VERSION 4.5.11 | |
ENV PATH ${CONDA_DIR}/bin:$HOME/.local/bin:${PATH} | |
RUN cd /tmp && \ | |
wget --quiet https://repo.continuum.io/miniconda/Miniconda3-${MINICONDA_VERSION}-Linux-x86_64.sh && \ | |
echo "e1045ee415162f944b6aebfe560b8fee *Miniconda3-${MINICONDA_VERSION}-Linux-x86_64.sh" | md5sum -c - && \ | |
/bin/bash Miniconda3-${MINICONDA_VERSION}-Linux-x86_64.sh -f -b -p $CONDA_DIR && \ | |
rm Miniconda3-${MINICONDA_VERSION}-Linux-x86_64.sh && \ | |
$CONDA_DIR/bin/conda config --system --prepend channels conda-forge && \ | |
$CONDA_DIR/bin/conda config --system --set auto_update_conda false && \ | |
$CONDA_DIR/bin/conda config --system --set show_channel_urls true && \ | |
$CONDA_DIR/bin/conda install -n base -c conda-canary conda=4.6 && \ | |
conda clean -tipsy && \ | |
ln -s /opt/conda/etc/profile.d/conda.sh /etc/profile.d/conda.sh && \ | |
echo ". /opt/conda/etc/profile.d/conda.sh" >> ~/.bashrc && \ | |
echo "conda activate base" >> ~/.bashrc && \ | |
rm -rf /home/${NB_USER}/.cache/yarn | |
# Copy files in repository to $HOME | |
#COPY . ${HOME} | |
USER root | |
RUN chown -R ${NB_UID} ${HOME} | |
USER ${NB_USER} | |
# Install dependencies | |
WORKDIR ${HOME} | |
RUN conda create -n deepbedmap python=3.6 | |
#RUN conda env create -n deepbedmap -f environment.yml && \ | |
# conda clean -tipsy && \ | |
# conda list -n deepbedmap | |
RUN echo "#!/bin/bash\n \ | |
source activate deepbedmap\n \ | |
pip install pipenv==2018.7.1\n \ | |
export LD_LIBRARY_PATH=\$CONDA_PREFIX/lib\n \ | |
pipenv install --python \$CONDA_PREFIX/bin/python jupyterlab" >> postBuild | |
RUN cat postBuild | |
RUN chmod +x postBuild | |
RUN ./postBuild | |
# Run Jupyter | |
EXPOSE 8888 | |
RUN echo "LD_LIBRARY_PATH=\${CONDA_PREFIX}/lib/" >> .env | |
RUN cat .env | |
SHELL ["/bin/bash", "-c"] | |
RUN ["conda", "run", "--help"] | |
RUN ["conda", "run", "-n", "deepbedmap", "pipenv", "run", "--help"] | |
RUN ["conda", "run", "pipenv"] | |
CMD ["conda", "run", "pipenv"] | |
#conda activate deepbedmap && pipenv run jupyter lab --ip 0.0.0.0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://mybinder.org/v2/gist/weiji14/ded3eb3c5b0810a181f15cbbc8e151a4/master