Skip to content
Snippets Groups Projects
Commit 3ee37ab2 authored by Jeremy M Fee's avatar Jeremy M Fee
Browse files

Update docker build to use new usgs/python:3.8-obspy image

parent 2c8458a4
No related branches found
No related tags found
2 merge requests!146Release CMO metadata to production,!123Poetry
ARG FROM_IMAGE=usgs/centos:7
ARG FROM_IMAGE=usgs/python:3.8-obspy
################################################################################
# base python image
FROM ${FROM_IMAGE} as python
ARG PYTHON_VERSION=38
LABEL maintainer="Jeremy Fee <jmfee@usgs.gov>"
# put rh-python38 at start of path
ENV PATH="/opt/rh/rh-python38/root/usr/bin:/opt/rh/rh-python38/root/usr/local/bin:${PATH}"
# configure ssl intercept
ENV PIP_CERT="${SSL_CERT_FILE}"
ENV REQUESTS_CA_BUNDLE="${SSL_CERT_FILE}"
RUN yum install -y \
centos-release-scl \
glibc-langpack-en \
which \
&& yum install -y rh-python${PYTHON_VERSION} \
&& python -m pip install -U \
pip \
poetry \
wheel \
&& yum clean all
################################################################################
# python builder image
FROM python as obspy
ARG PYTHON_VERSION=38
# build with compilers in separate stage
RUN yum groupinstall -y "Development Tools"
RUN yum install -y rh-python${PYTHON_VERSION}-python-devel
ENV LD_LIBRARY_PATH="/opt/rh/rh-python${PYTHON_VERSION}/root/usr/lib64"
ENV PKG_CONFIG_PATH="/opt/rh/rh-python${PYTHON_VERSION}/root/usr/lib64/pkgconfig"
# obspy
RUN python -m pip wheel obspy --wheel-dir /wheels
# pycurl
RUN yum install -y libcurl-devel openssl-devel
RUN export PYCURL_SSL_LIBRARY=nss \
&& python -m pip wheel pycurl --wheel-dir /wheels
################################################################################
# geomag-algorithms image
FROM python
FROM ${FROM_IMAGE}
ARG GIT_BRANCH_NAME=none
ARG GIT_COMMIT_SHA=none
......@@ -61,9 +12,8 @@ ENV GIT_BRANCH_NAME=${GIT_BRANCH_NAME} \
GIT_COMMIT_SHA=${GIT_COMMIT_SHA} \
WEBSERVICE=${WEBSERVICE}
# install obspy and pycurl using wheels
COPY --from=obspy /wheels /wheels
RUN python -m pip install --find-links file:///wheels obspy pycurl
# install to system python
USER root
# install packages when dependencies change
COPY pyproject.toml poetry.lock /geomag-algorithms/
......@@ -73,7 +23,7 @@ RUN cd /geomag-algorithms \
# only install dependencies, not project
&& poetry install --no-root
# install rest of library as editable
# install rest of library separate from dependencies
COPY . /geomag-algorithms
RUN cd /geomag-algorithms \
# now install project to install scripts
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment