Skip to content

Instantly share code, notes, and snippets.

@shubhamagarwal92
Last active August 9, 2019 23:30
Show Gist options
  • Save shubhamagarwal92/c5983009c1e662d438dd7a43a5587f7f to your computer and use it in GitHub Desktop.
Save shubhamagarwal92/c5983009c1e662d438dd7a43a5587f7f to your computer and use it in GitHub Desktop.
This shows how to create an environment and sourcing it in dockerfile
RUN /bin/bash -c "apt-get install tmux -y"
RUN /bin/bash -c "apt-get install htop -y"
# Trying conda environment
RUN /opt/conda/bin/conda create -y --name myenv python=3.6.8 && \
/opt/conda/bin/conda clean -ya
RUN echo "source activate myenv" > ~/.bashrc
ENV PATH /opt/conda/envs/myenv/bin:$PATH
# COPY ./app /app
RUN pip install -r /app/requirements.txt
# or
RUN pip install h5py==2.8.0 nltk==3.4 numpy==1.15.4 Pillow==5.3.0 pyyaml tensorboardX==1.2 \
tensorflow==1.12.0 allennlp==0.8.2 tqdm==4.28.1 torch==1.0.0
RUN pip install pytorch-transformers
# or
RUN pip install pytorch_pretrained_bert
RUN /opt/conda/envs/myenv/bin/python -c "import nltk; nltk.download('punkt')"
# This is how we can delete the images
# docker images
# docker rmi -f <id>
# docker system prune
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment