Multistage build
This commit is contained in:
19
Dockerfile
19
Dockerfile
@ -1,12 +1,13 @@
|
||||
FROM python:3.10.11-alpine3.17
|
||||
FROM python:3.10.11-alpine3.17 as env-builder
|
||||
|
||||
# handle optional arguments
|
||||
ARG INTERNAL_API_PORT=8010
|
||||
ARG INTERNAL_WS_PORT=8011
|
||||
|
||||
RUN \
|
||||
pip install pip -U && \
|
||||
pip install poetry --no-cache-dir
|
||||
apk add --no-cache gcc musl-dev libffi-dev && \
|
||||
pip install pip -U --no-cache-dir --prefer-binary && \
|
||||
pip install poetry --no-cache-dir --prefer-binary
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
@ -29,6 +30,18 @@ RUN \
|
||||
# install python libs
|
||||
pip install -r requirements.txt --no-cache-dir --prefer-binary
|
||||
|
||||
|
||||
FROM python:3.10.11-alpine3.17 as runner
|
||||
|
||||
WORKDIR /app
|
||||
COPY --from=env-builder /venv /venv
|
||||
|
||||
# set python thingies and activate virtual environment
|
||||
ENV \
|
||||
PYTHONDONTWRITEBYTECODE=1 \
|
||||
PYTHONUNBUFFERED=1 \
|
||||
PATH="/venv/bin:$PATH"
|
||||
|
||||
# copy all relevant files
|
||||
COPY ./.docker/* ./
|
||||
COPY ./hopper ./hopper
|
||||
|
||||
Reference in New Issue
Block a user