Skip to content
Snippets Groups Projects
Dockerfile 952 B
Newer Older
  • Learn to ignore specific revisions
  • 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's avatar
    Jeremy M Fee committed
    ARG WEBSERVICE="false"
    
    # set environment variables
    
    ENV GIT_BRANCH_NAME=${GIT_BRANCH_NAME} \
        GIT_COMMIT_SHA=${GIT_COMMIT_SHA} \
    
        WEBSERVICE=${WEBSERVICE}
    
    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's avatar
    Jeremy M Fee committed
        && pip cache purge
    
    # entrypoint needs double quotes
    
    ENTRYPOINT [ "/app/docker-entrypoint.sh" ]