ajout des Dockerfile & compose

This commit is contained in:
Tie 2026-04-10 02:12:18 +02:00
parent b22231c8b6
commit 19a0bdb2bb
4 changed files with 147 additions and 0 deletions

66
Dockerfile.builder Normal file
View file

@ -0,0 +1,66 @@
FROM python:3.12-slim
WORKDIR /app
RUN apt update && apt install -y --no-install-suggests --no-install-recommends \
libjpeg-dev \
zlib1g-dev \
build-essential \
ca-certificates \
curl \
gnupg \
cmake \
ninja-build \
git
RUN apt install -y libjpeg62 libpng-dev libtiff-dev libz-dev libproj-dev liblzma-dev libjbig-dev libzstd-dev libgeotiff-dev libwebp-dev liblzma-dev nlohmann-json3-dev
ENV GDAL_VERSION 3.12.2
ADD http://download.osgeo.org/gdal/${GDAL_VERSION}/gdal-${GDAL_VERSION}.tar.gz /usr/local/src/
RUN cd /usr/local/src && tar -xvf gdal-${GDAL_VERSION}.tar.gz && cd gdal-${GDAL_VERSION} \
&& cmake -S . -B build \
-G Ninja \
-DCMAKE_INSTALL_PREFIX=/usr/local \
-DBUILD_SHARED_LIBS=ON \
&& cmake --build build --config Release \
&& cmake --install build \
&& ldconfig
#&& rm -Rf /usr/local/src/*
RUN git clone https://github.com/LASzip/LASzip.git && cd LASzip \
&& cmake -S . -B build \
-G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/usr/local \
-DBUILD_SHARED_LIBS=ON \
&& cmake --build build \
&& cmake --install build --config Release \
&& ldconfig
RUN git clone https://github.com/PDAL/PDAL.git && cd PDAL \
&& cmake -S . -B build \
-G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/usr/local \
-DCMAKE_PREFIX_PATH=/usr/local \
-DBUILD_PLUGIN_LASZIP=ON \
-DGDAL_DIR=/usr/local/lib/cmake/gdal \
&& cmake --build build \
&& cmake --install build --config Release \
&& ldconfig
RUN git clone https://github.com/connormanning/entwine.git && cd entwine \
&& cmake -S . -B build \
-G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/usr/local \
-DCMAKE_PREFIX_PATH=/usr/local \
&& cmake --build build \
&& cmake --install build --config Release \
&& ldconfig
RUN apt remove -y libgeotiff-dev libpng-dev libtiff-dev libjpeg-dev libz-dev libproj-dev liblzma-dev libjbig-dev libzstd-dev libgeotiff-dev libwebp-dev liblzma-dev nlohmann-json3-dev ninja-build cmake build-essential zlib1g-dev \
&& apt autoremove -y \
&& rm -rf /usr/local/src/* /var/lib/apt/lists/* /tmp/* /var/tmp/*

26
Dockerfile.entwine Normal file
View file

@ -0,0 +1,26 @@
FROM entwine:python3.12
RUN apt update && apt install -y --no-install-suggests --no-install-recommends build-essential libpng-dev libtiff-dev libz-dev libproj-dev liblzma-dev libjbig-dev libzstd-dev libgeotiff-dev libwebp-dev
# installer uv
RUN pip install uv
# Do you need open3d ?
# copier dépendances
COPY pyproject.toml requirements.txt ./
RUN uv add -r requirements.txt
RUN apt remove -y build-essential \
&& apt autoremove -y \
&& rm -rf /usr/local/src/* /var/lib/apt/lists/* /tmp/* /var/tmp/*
# copier code
COPY backend ./backend
WORKDIR /app/backend
EXPOSE 8000
CMD ["uv", "run", "uvicorn", "main:app", "--reload", "--host", "0.0.0.0", "--port", "8000"]

25
Dockerfile.frontend Normal file
View file

@ -0,0 +1,25 @@
FROM python:3.12-slim
WORKDIR /app
RUN apt update && apt install libjpeg-dev zlib1g-dev build-essential -y
RUN pip install uv
COPY pyproject.toml requirements.txt ./
RUN uv add -r requirements.txt
COPY frontend ./frontend
WORKDIR /app/frontend
EXPOSE 8080
#ENV STREAMLIT_SERVER_MAX_UPLOAD_SIZE=3000
# Variable d'environnement pour l'URL du backend
# Peut être définie via docker-compose.yml
ENV BACKEND_URL="http://backend_entwine:8090"
CMD ["uv", "run", "uvicorn", "main:app", "--reload", "--host", "0.0.0.0", "--port", "8080"]

30
docker-compose.yml Normal file
View file

@ -0,0 +1,30 @@
services:
backend_entwine:
build:
context: .
dockerfile: Dockerfile.entwine
container_name: pointcloud-backend-htmx
ports:
- "8090:8000"
volumes:
- ./backend:/app/backend
environment:
- HOST_DATA_DIR=/app/backend/data
restart: unless-stopped
frontend_htmx:
build:
context: .
dockerfile: Dockerfile.frontend
container_name: pointcloud-frontend-htmx
ports:
- "8091:8080"
volumes:
- ./frontend:/app/frontend
environment:
- MAX_UPLOAD_SIZE_GB=10
- BACKEND_URL=http://backend_entwine:8000
depends_on:
- backend_entwine
restart: unless-stopped