26 lines
660 B
Plaintext
26 lines
660 B
Plaintext
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 ./requirements.txt ./requirements.txt
|
|
|
|
# Install dependencies.
|
|
RUN python3 -m pip install -r requirements.txt
|
|
|
|
# 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
|