FROM python:3.8 as builder1 # Use a virtual environment. RUN python -m venv /app/venv ENV PATH="/app/venv/bin:$PATH" # Upgrade pip. RUN python -m pip install --upgrade pip # Make a directory for the service files and copy the service repo into the container. WORKDIR /app/service COPY . ./ # Set up service as a module and install all its dependencies. RUN bash setup/docker_local.sh # Make a new container and copy all relevant files over to filter out temporary files # produced during setup to reduce the final container's size. FROM python:3.8 WORKDIR /app/ COPY --from=builder1 /app . ENV PATH="/app/venv/bin:$PATH" WORKDIR /app/service RUN apt update --yes RUN apt install vim --yes RUN apt install poppler-utils --yes EXPOSE 5000 EXPOSE 8080 # Run the service loop. CMD ["python3", "src/run_service.py"]