Skip to content

Instantly share code, notes, and snippets.

@jerowe
Created January 19, 2019 07:47
Show Gist options
  • Select an option

  • Save jerowe/5de67ea90886472666ac905464e5fbdf to your computer and use it in GitHub Desktop.

Select an option

Save jerowe/5de67ea90886472666ac905464e5fbdf to your computer and use it in GitHub Desktop.
FROM continuumio/miniconda3:4.5.11
RUN apt-get update -y; apt-get upgrade -y
# You don't technically need these, but I get kind of twitchy if I don't have vim installed
RUN apt-get install -y vim-tiny vim-athena ssh
# Add a user and switch, using the default root user is BAD
RUN adduser --home /home/flask flask
USER flask
WORKDIR /home/flask
RUN mkdir -p flask_app
WORKDIR /home/flask/flask_app
# Always save your environments in a conda env file.
# This makes it so much easier to fix your environment when you inadvertantly clobber it
COPY flask-app-environment.yml environment.yml
RUN conda env create -f environment.yml
RUN echo "alias l='ls -lah'" >> ~/.bashrc
# This is the conda magic. If you are running through a shell just activating the environment in your profile is peachy
RUN echo "source activate flask-app" >> ~/.bashrc
# This is the equivalent of running `source activate`
# Its handy to have in case you want to run additional commands in the Dockerfile
ENV CONDA_EXE /opt/conda/bin/conda
ENV CONDA_PREFIX /home/flask/.conda/envs/flask-app
ENV CONDA_PYTHON_EXE /opt/conda/bin/python
ENV CONDA_PROMPT_MODIFIER (flask-app)
ENV CONDA_DEFAULT_ENV flask-app
ENV PATH /home/flask/.conda/envs/flask-app/bin:/opt/conda/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
COPY . ./
CMD ["/bin/bash", "-c", "/home/flask/flask_app/start_flask_app.sh"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment