Newer
Older
ARG FROM_IMAGE=usgs/centos:7
LABEL maintainer="Jeremy Fee <jmfee@usgs.gov>"

Jeremy M Fee
committed
ARG GIT_BRANCH_NAME=none
ARG GIT_COMMIT_SHA=none
# set environment variables

Jeremy M Fee
committed
ENV GIT_BRANCH_NAME=${GIT_BRANCH_NAME} \
GIT_COMMIT_SHA=${GIT_COMMIT_SHA} \
LANG='en_US.UTF-8' \

Jeremy M Fee
committed
PATH=/conda/bin:$PATH \

Jeremy M Fee
committed
PIP_CERT=${SSL_CERT_FILE} \

Jeremy M Fee
committed
PYTHONDONTWRITEBYTECODE=1 \

Jeremy M Fee
committed
PYTHONUNBUFFERED=1 \
REQUESTS_CA_BUNDLE=${SSL_CERT_FILE}
RUN echo 'export PATH=/conda/bin:$PATH' > /etc/profile.d/conda.sh \
&& curl \
https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh \
-o ~/miniconda.sh \
&& /bin/bash ~/miniconda.sh -b -p /conda \
&& rm ~/miniconda.sh
# install dependencies via conda
RUN conda config --set ssl_verify $SSL_CERT_FILE \
&& conda config --add channels conda-forge \
&& conda install --yes jupyter obspy pycurl \
&& conda clean --all -y \

Jeremy M Fee
committed
&& pip install pipenv 'virtualenv!=20.0.22' \
&& yum install -y which \
&& yum clean all
################################################################################
## Development image
# build by running
# docker build -t geomag-algorithms-development --target development .
FROM conda as development
# install dependencies via pipenv
WORKDIR /geomag-algorithms
COPY Pipfile /geomag-algorithms
RUN pipenv --site-packages install --dev --skip-lock
# copy library (ignores set in .dockerignore)
COPY . /geomag-algorithms
################################################################################
## Production image
FROM conda
-c 'Docker image user' \
-m \
-r \
-s /sbin/nologin \
geomag_user \
&& mkdir -p /data \
&& chown -R geomag_user:geomag_user /data
USER geomag_user
# install dependencies via pipenv
WORKDIR /data

Jeremy M Fee
committed
COPY Pipfile /data/
RUN pipenv --site-packages install --skip-lock
# copy library (ignores set in .dockerignore)
COPY . /geomag-algorithms
# entrypoint needs double quotes
ENTRYPOINT [ "/geomag-algorithms/docker-entrypoint.sh" ]