Newer
Older
ARG FROM_IMAGE=code.usgs.gov:5001/devops/images/usgs/python:3.10-obspy
FROM ${FROM_IMAGE} as build
USER root
WORKDIR /app
# install dependencies in separate layer
# this is a temporary container and they change less often than other files
COPY poetry.lock pyproject.toml /app/
RUN poetry install --no-root
COPY . /app/
RUN poetry build
# install and configure entrypoint

Jeremy M Fee
committed
ARG GIT_BRANCH_NAME=none
ARG GIT_COMMIT_SHA=none

Jeremy M Fee
committed
# set environment variables

Jeremy M Fee
committed
ENV GIT_BRANCH_NAME=${GIT_BRANCH_NAME} \
GIT_COMMIT_SHA=${GIT_COMMIT_SHA} \
COPY --from=build /app/dist/*.whl /app/docker-entrypoint.sh /app/
# install as root
USER root
RUN apt update \
&& apt upgrade -y \
&& pip install --upgrade --upgrade-strategy eager /app/*.whl \

Jeremy M Fee
committed
USER usgs-user
# entrypoint needs double quotes
ENTRYPOINT [ "/app/docker-entrypoint.sh" ]