mirror of
https://github.com/immich-app/immich.git
synced 2025-01-19 18:26:46 +01:00
977740045a
* Use multi stage build to slim down ML image size * Use gunicorn as WSGI server in ML image * Configure gunicorn server for ML use case * Use requirements.txt file to install python dependencies in ML image * Make ML listen IP configurable
26 lines
553 B
Docker
26 lines
553 B
Docker
FROM python:3.10 as builder
|
|
|
|
ENV PYTHONDONTWRITEBYTECODE=1 \
|
|
PYTHONUNBUFFERED=1 \
|
|
PIP_NO_CACHE_DIR=true
|
|
|
|
COPY requirements.txt ./
|
|
|
|
RUN python -m venv /opt/venv && \
|
|
/opt/venv/bin/pip install --upgrade pip setuptools wheel && \
|
|
/opt/venv/bin/pip install --no-deps -r requirements.txt
|
|
|
|
FROM python:3.10-slim
|
|
|
|
COPY --from=builder /opt/venv /opt/venv
|
|
|
|
ENV TRANSFORMERS_CACHE=/cache \
|
|
PYTHONDONTWRITEBYTECODE=1 \
|
|
PYTHONUNBUFFERED=1 \
|
|
PATH="/opt/venv/bin:$PATH"
|
|
|
|
WORKDIR /usr/src/app
|
|
|
|
COPY . .
|
|
|
|
CMD ["gunicorn", "src.main:server"]
|