fix: docker permissions (#2059)

* fix: missing depends_on

* chore: update copy permissions

* chore: update entrypoint

* Revert "chore: update entrypoint"

This reverts commit f73a36af2f.

* Revert "chore: update copy permissions"

This reverts commit fabc3f66bb.

* style: fix docker warning

* fix: multiples fixes

* fix: user permissions writing local_data folder
This commit is contained in:
Javier Martinez 2024-09-24 08:30:58 +02:00 committed by GitHub
parent 77461b96cf
commit 8c12c6830b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 14 additions and 10 deletions

View File

@ -1,6 +1,6 @@
### IMPORTANT, THIS IMAGE CAN ONLY BE RUN IN LINUX DOCKER ### IMPORTANT, THIS IMAGE CAN ONLY BE RUN IN LINUX DOCKER
### You will run into a segfault in mac ### You will run into a segfault in mac
FROM python:3.11.6-slim-bookworm as base FROM python:3.11.6-slim-bookworm AS base
# Install poetry # Install poetry
RUN pip install pipx RUN pip install pipx
@ -20,14 +20,14 @@ RUN apt update && apt install -y \
# https://python-poetry.org/docs/configuration/#virtualenvsin-project # https://python-poetry.org/docs/configuration/#virtualenvsin-project
ENV POETRY_VIRTUALENVS_IN_PROJECT=true ENV POETRY_VIRTUALENVS_IN_PROJECT=true
FROM base as dependencies FROM base AS dependencies
WORKDIR /home/worker/app WORKDIR /home/worker/app
COPY pyproject.toml poetry.lock ./ COPY pyproject.toml poetry.lock ./
ARG POETRY_EXTRAS="ui embeddings-huggingface llms-llama-cpp vector-stores-qdrant" ARG POETRY_EXTRAS="ui embeddings-huggingface llms-llama-cpp vector-stores-qdrant"
RUN poetry install --no-root --extras "${POETRY_EXTRAS}" RUN poetry install --no-root --extras "${POETRY_EXTRAS}"
FROM base as app FROM base AS app
ENV PYTHONUNBUFFERED=1 ENV PYTHONUNBUFFERED=1
ENV PORT=8080 ENV PORT=8080

View File

@ -1,4 +1,4 @@
FROM python:3.11.6-slim-bookworm as base FROM python:3.11.6-slim-bookworm AS base
# Install poetry # Install poetry
RUN pip install pipx RUN pip install pipx
@ -10,14 +10,14 @@ ENV PATH=".venv/bin/:$PATH"
# https://python-poetry.org/docs/configuration/#virtualenvsin-project # https://python-poetry.org/docs/configuration/#virtualenvsin-project
ENV POETRY_VIRTUALENVS_IN_PROJECT=true ENV POETRY_VIRTUALENVS_IN_PROJECT=true
FROM base as dependencies FROM base AS dependencies
WORKDIR /home/worker/app WORKDIR /home/worker/app
COPY pyproject.toml poetry.lock ./ COPY pyproject.toml poetry.lock ./
ARG POETRY_EXTRAS="ui vector-stores-qdrant llms-ollama embeddings-ollama" ARG POETRY_EXTRAS="ui vector-stores-qdrant llms-ollama embeddings-ollama"
RUN poetry install --no-root --extras "${POETRY_EXTRAS}" RUN poetry install --no-root --extras "${POETRY_EXTRAS}"
FROM base as app FROM base AS app
ENV PYTHONUNBUFFERED=1 ENV PYTHONUNBUFFERED=1
ENV PORT=8080 ENV PORT=8080
ENV APP_ENV=prod ENV APP_ENV=prod

View File

@ -8,11 +8,12 @@ services:
# This service builds from an external Dockerfile and runs the Ollama mode. # This service builds from an external Dockerfile and runs the Ollama mode.
private-gpt-ollama: private-gpt-ollama:
image: ${PGPT_IMAGE:-zylonai/private-gpt}:${PGPT_TAG:-0.6.2}-ollama # x-release-please-version image: ${PGPT_IMAGE:-zylonai/private-gpt}:${PGPT_TAG:-0.6.2}-ollama # x-release-please-version
user: root
build: build:
context: . context: .
dockerfile: Dockerfile.ollama dockerfile: Dockerfile.ollama
volumes: volumes:
- ./local_data/:/home/worker/app/local_data - ./local_data:/home/worker/app/local_data
ports: ports:
- "8001:8001" - "8001:8001"
environment: environment:
@ -27,11 +28,14 @@ services:
- ollama-cpu - ollama-cpu
- ollama-cuda - ollama-cuda
- ollama-api - ollama-api
depends_on:
- ollama
# Private-GPT service for the local mode # Private-GPT service for the local mode
# This service builds from a local Dockerfile and runs the application in local mode. # This service builds from a local Dockerfile and runs the application in local mode.
private-gpt-llamacpp-cpu: private-gpt-llamacpp-cpu:
image: ${PGPT_IMAGE:-zylonai/private-gpt}:${PGPT_TAG:-0.6.2}-llamacpp-cpu # x-release-please-version image: ${PGPT_IMAGE:-zylonai/private-gpt}:${PGPT_TAG:-0.6.2}-llamacpp-cpu # x-release-please-version
user: root
build: build:
context: . context: .
dockerfile: Dockerfile.llamacpp-cpu dockerfile: Dockerfile.llamacpp-cpu
@ -44,7 +48,7 @@ services:
environment: environment:
PORT: 8001 PORT: 8001
PGPT_PROFILES: local PGPT_PROFILES: local
HF_TOKEN: ${HF_TOKEN} HF_TOKEN: ${HF_TOKEN:-}
profiles: profiles:
- llamacpp-cpu - llamacpp-cpu
@ -57,7 +61,7 @@ services:
ollama: ollama:
image: traefik:v2.10 image: traefik:v2.10
ports: ports:
- "8081:8080" - "11434:11434"
command: command:
- "--providers.file.filename=/etc/router.yml" - "--providers.file.filename=/etc/router.yml"
- "--log.level=ERROR" - "--log.level=ERROR"