Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Docker configuration and dependencies #2219

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ test:
pytest backend/

dev:
docker compose -f docker-compose.dev.yml build backend-core
docker compose -f docker-compose.dev.yml up --build
docker compose -f docker-compose.dev.yml up

dev-saas:
docker compose -f docker-compose-dev-saas-supabase.yml build backend-core
Expand Down
3 changes: 2 additions & 1 deletion backend/.dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@
**/.next/
**/build/
**/.docusaurus/
**/node_modules/
**/node_modules/
**/.venv/
35 changes: 11 additions & 24 deletions backend/Dockerfile.dev
Original file line number Diff line number Diff line change
Expand Up @@ -5,51 +5,38 @@ ARG DEV_MODE
ENV DEV_MODE=$DEV_MODE

# Install GEOS library, Rust, and other dependencies, then clean up
RUN apt-get clean && apt-get update && apt-get install -y \
RUN apt-get update && apt-get install -y \
libgeos-dev \
libcurl4-openssl-dev \
libssl-dev \
binutils \
pandoc \
curl \
git \
poppler-utils \
tesseract-ocr \
autoconf \
automake \
build-essential \
libtool \
python-dev \
build-essential \
# Additional dependencies for document handling
libmagic-dev \
poppler-utils \
tesseract-ocr \
libreoffice \
libpq-dev \
gcc \
pandoc && \
&& curl -sSL https://install.python-poetry.org | python3 - && \
rm -rf /var/lib/apt/lists/* && apt-get clean

# Add Rust binaries to the PATH
ENV PATH="/root/.cargo/bin:${PATH}"
# Add Rust and Poetry binaries to the PATH
ENV PATH="/root/.cargo/bin:/root/.local/bin:${PATH}"

# Copy just the requirements first
COPY ./requirements.txt .

# Upgrade pip
RUN pip install --upgrade pip
WORKDIR /code

# Increase timeout to wait for the new installation
RUN pip install --no-cache-dir -r requirements.txt --timeout 200
# Copy the pyproject.toml and poetry.lock files (if exists) to the container
COPY pyproject.toml poetry.lock* ./

RUN if [ "$DEV_MODE" = "true" ]; then pip install --no-cache debugpy --timeout 200; fi
# Disable virtualenv creation by Poetry and install dependencies
RUN poetry config virtualenvs.create false && \
poetry install --without worker --no-interaction --no-ansi

WORKDIR /code
# Copy the rest of the application
COPY . .


EXPOSE 5050

CMD ["uvicorn", "main:app","--reload", "--host", "0.0.0.0", "--port", "5050", "--workers", "6"]
CMD ["uvicorn", "main:app", "--reload", "--host", "0.0.0.0", "--port", "5050", "--workers", "6"]
52 changes: 52 additions & 0 deletions backend/Dockerfile.worker.dev
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# Using a slim version for a smaller base image
FROM python:3.11.6-slim-bullseye@sha256:0c1fbb294096d842ad795ee232d783cab436c90b034210fe894f2bb2f2be7626

ARG DEV_MODE
ENV DEV_MODE=$DEV_MODE

# Install GEOS library, Rust, and other dependencies, then clean up
RUN apt-get update && apt-get install -y \
libgeos-dev \
libcurl4-openssl-dev \
libssl-dev \
binutils \
pandoc \
curl \
git \
poppler-utils \
tesseract-ocr \
autoconf \
automake \
build-essential \
libtool \
python-dev \
build-essential \
# Additional dependencies for document handling
libmagic-dev \
poppler-utils \
tesseract-ocr \
libreoffice \
libpq-dev \
gcc \
pandoc && \
curl -sSL https://install.python-poetry.org | python3 - && \
rm -rf /var/lib/apt/lists/* && apt-get clean

# Add Rust and Poetry binaries to the PATH
ENV PATH="/root/.cargo/bin:/root/.local/bin:${PATH}"

WORKDIR /code

# Copy the pyproject.toml and poetry.lock files (if exists) to the container
COPY pyproject.toml poetry.lock* ./

# Disable virtualenv creation by Poetry and install dependencies
RUN poetry config virtualenvs.create false && \
poetry install --no-interaction --no-ansi --with main,worker

# Copy the rest of the application
COPY . .

EXPOSE 5050

CMD ["uvicorn", "main:app", "--reload", "--host", "0.0.0.0", "--port", "5050", "--workers", "6"]
Loading
Loading