diff --git a/api/Dockerfile.debian b/api/Dockerfile.debian new file mode 100644 index 000000000..b5ee1a1d1 --- /dev/null +++ b/api/Dockerfile.debian @@ -0,0 +1,64 @@ +FROM python:3.11-slim AS builder + +ARG POETRY_VERSION=1.8 + +ENV VIRTUAL_ENV=/venv +ENV PATH="/venv/bin:$PATH" + +ENV POETRY_HOME=/opt/poetry +ENV POETRY_NO_INTERACTION=1 +ENV POETRY_VIRTUALENVS_IN_PROJECT=1 +ENV POETRY_VIRTUALENVS_CREATE=1 +ENV PYTHONDONTWRITEBYTECODE=1 +ENV PYTHONUNBUFFERED=1 +# Tell Poetry where to place its cache and virtual environment +ENV POETRY_CACHE_DIR=/opt/.cache + +RUN pip install "poetry==${POETRY_VERSION}" + +RUN apt update; \ + apt install -y \ + build-essential \ + python3-dev \ + libldap-dev \ + libsasl2-dev \ + slapd \ + ldap-utils \ + tox \ + lcov \ + valgrind + +WORKDIR /app + +COPY pyproject.toml . + +RUN python3 -m venv --system-site-packages ${VIRTUAL_ENV} && . ${VIRTUAL_ENV}/bin/activate +RUN --mount=type=cache,target=/opt/.cache \ + poetry install --no-root --extras typesense + +FROM python:3.11-slim AS runtime + +ARG POETRY_VERSION=1.8 + +ENV VIRTUAL_ENV=/venv +ENV PATH="/venv/bin:$PATH" + +RUN apt update; apt install -y \ + ffmpeg \ + gettext \ + libjpeg-dev \ + libldap-2.5-0 \ + libmagic1 \ + libpq5 \ + libxml2 \ + libxslt1.1 +RUN pip install "poetry==${POETRY_VERSION}" + +COPY --from=builder ${VIRTUAL_ENV} ${VIRTUAL_ENV} + +WORKDIR /app + +COPY . /app +RUN poetry install --extras typesense + +CMD ["./docker/server.sh"] diff --git a/compose/app.django.yml b/compose/app.django.yml index f26ea0a69..18a657017 100644 --- a/compose/app.django.yml +++ b/compose/app.django.yml @@ -20,9 +20,7 @@ services: <<: *django build: context: ../api - dockerfile: Dockerfile - args: - install_dev_deps: 1 + dockerfile: Dockerfile.debian command: > bash -c " funkwhale-manage migrate &&