From 80398769f3b04bcf911488b18442ef7b2aee22bd Mon Sep 17 00:00:00 2001
From: Jeremy Fee <jmfee@usgs.gov>
Date: Thu, 5 Mar 2020 09:09:34 -0700
Subject: [PATCH] Update Dockerfile to use usgs/centos8

---
 Dockerfile           | 40 +++++++++++++++-------------------------
 docker-entrypoint.sh | 18 +++++++++---------
 2 files changed, 24 insertions(+), 34 deletions(-)

diff --git a/Dockerfile b/Dockerfile
index 570ebfc8..7dabf4b0 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,13 +1,8 @@
-ARG BUILD_IMAGE=usgs/centos:7
-ARG FROM_IMAGE=usgs/centos:7
-FROM $BUILD_IMAGE AS pycurl-build
+ARG FROM_IMAGE=usgs/centos:8
+
+FROM $FROM_IMAGE
+LABEL maintainer="Jeremy Fee <jmfee@usgs.gov>"
 
-# install conda dependencies
-RUN yum install -y \
-        bzip2 \
-        gcc \
-        libcurl-devel \
-    && yum clean all
 
 # install conda
 ENV PATH /conda/bin:$PATH
@@ -21,29 +16,24 @@ RUN echo 'export PATH=/conda/bin:$PATH' > /etc/profile.d/conda.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 \
-    # build pycurl with SFTP support
+    && conda install --yes jupyter obspy pycurl \
+    && conda clean --all -y \
     && export PIP_CERT=$SSL_CERT_FILE \
-    && export PYCURL_SSL_LIBRARY=nss \
-    && pip install pycurl \
-    # clean up
-    && conda clean --all -y
-
+    && pip install \
+        authlib \
+        flask \
+        flask-login \
+        flask-migrate \
+        flask-session \
+        flask-sqlalchemy \
+        psycopg2-binary
 
-FROM $FROM_IMAGE
-LABEL maintainer="Jeremy Fee <jmfee@usgs.gov>"
-
-# use conda install from build container
-ENV PATH /conda/bin:$PATH
-COPY --from=pycurl-build /conda /conda
-COPY --from=pycurl-build /etc/profile.d/conda.sh /etc/profile.d/conda.sh
 
 # copy library (ignores set in .dockerignore)
 COPY . /geomag-algorithms
 
 
-RUN pip install /geomag-algorithms \
-    && useradd \
+RUN useradd \
         -c 'Docker image user' \
         -m \
         -r \
diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh
index 40d4d80d..88e66799 100755
--- a/docker-entrypoint.sh
+++ b/docker-entrypoint.sh
@@ -4,21 +4,21 @@
 # "exec" seems like a much simpler solution for this,
 # however, jupyter kernels die noisy deaths when using exec.
 
-_term () {
-  echo 'Caught SIGERM'
-  kill -TERM "$child"
-}
-trap _term SIGTERM
+# _term () {
+#  echo 'Caught SIGTERM'
+#  kill -TERM "$child"
+#}
+#trap _term SIGTERM
 
 # add geomagio to notebook path
 export PYTHONPATH=/geomag-algorithms
 
 # run jupyter notebook server
-jupyter notebook \
+exec jupyter notebook \
     --ip='*' \
     --notebook-dir=/home/geomag_user/notebooks \
     --no-browser \
-    --port=8000 &
+    --port=8000
 
-child=$!
-wait "$child"
+#child=$!
+#wait "$child"
-- 
GitLab