JakubBodzioch commited on
Commit
6702bc1
1 Parent(s): c517bd5

Docker fix: Python 3.12, GDAL envs and fixed frontend build

Browse files
Files changed (1) hide show
  1. Dockerfile +19 -10
Dockerfile CHANGED
@@ -2,44 +2,53 @@
2
  FROM node:18 AS build-step
3
  WORKDIR /app/frontend
4
 
5
- # Copy npm configuration files from the frontend directory
6
  COPY io-app-front/package*.json ./
7
  RUN npm install
8
 
9
- # Copy the rest of the frontend source code and build it
10
  COPY io-app-front/ ./
11
  RUN npm run build
12
 
13
  # --- STAGE 2: Backend Server (Python + Flask) ---
14
- FROM python:3.11-slim
 
15
  WORKDIR /app
16
 
17
- # Install system dependencies required for geospatial libraries (GDAL/Rasterio)
18
  RUN apt-get update && apt-get install -y \
19
  build-essential \
20
  libgdal-dev \
21
  python3-dev \
 
22
  && rm -rf /var/lib/apt/lists/*
23
 
24
- # Copy requirements.txt and install Python libraries
 
 
 
 
 
25
  COPY io-app-backend/requirements.txt .
 
26
  RUN pip install --no-cache-dir -r requirements.txt
27
 
28
- # Set the working directory for the backend
29
  WORKDIR /app/io-app-backend
30
 
31
- # Copy the built frontend (Vite's 'dist' folder) to Flask's static directory
32
  COPY --from=build-step /app/frontend/dist /app/io-app-backend/static
33
 
34
- # Copy all backend source code
35
  COPY io-app-backend/ .
36
 
37
- # Set environment variables for Flask and Hugging Face (default port 7860)
38
  ENV FLASK_APP=app.py
39
  ENV FLASK_RUN_HOST=0.0.0.0
40
  ENV FLASK_RUN_PORT=7860
 
41
 
42
  EXPOSE 7860
43
 
44
- # Launch the application
45
  CMD ["python", "app.py"]
 
2
  FROM node:18 AS build-step
3
  WORKDIR /app/frontend
4
 
5
+ # Kopiujemy pliki konfiguracyjne frontendu
6
  COPY io-app-front/package*.json ./
7
  RUN npm install
8
 
9
+ # Kopiujemy reszt臋 plik贸w frontendu i budujemy (bez tsc, samo vite build)
10
  COPY io-app-front/ ./
11
  RUN npm run build
12
 
13
  # --- STAGE 2: Backend Server (Python + Flask) ---
14
+ # U偶ywamy 3.12, 偶eby spe艂ni膰 wymagania rasterio 1.5.0 i contourpy
15
+ FROM python:3.12-slim
16
  WORKDIR /app
17
 
18
+ # Instalacja zale偶no艣ci systemowych dla GDAL i kompilacji bibliotek C++
19
  RUN apt-get update && apt-get install -y \
20
  build-essential \
21
  libgdal-dev \
22
  python3-dev \
23
+ g++ \
24
  && rm -rf /var/lib/apt/lists/*
25
 
26
+ # Zmienne 艣rodowiskowe dla kompilatora (kluczowe dla bibliotek GIS)
27
+ ENV CPLUS_INCLUDE_PATH=/usr/include/gdal
28
+ ENV C_INCLUDE_PATH=/usr/include/gdal
29
+ ENV GDAL_CONFIG=/usr/bin/gdal-config
30
+
31
+ # Kopiujemy wymagania i instalujemy paczki
32
  COPY io-app-backend/requirements.txt .
33
+ RUN pip install --upgrade pip setuptools wheel
34
  RUN pip install --no-cache-dir -r requirements.txt
35
 
36
+ # Przygotowanie struktury folder贸w dla backendu
37
  WORKDIR /app/io-app-backend
38
 
39
+ # Kopiujemy zbudowany frontend (dist) do folderu static backendu
40
  COPY --from=build-step /app/frontend/dist /app/io-app-backend/static
41
 
42
+ # Kopiujemy reszt臋 kodu backendu
43
  COPY io-app-backend/ .
44
 
45
+ # Konfiguracja Flask
46
  ENV FLASK_APP=app.py
47
  ENV FLASK_RUN_HOST=0.0.0.0
48
  ENV FLASK_RUN_PORT=7860
49
+ ENV PYTHONUNBUFFERED=1
50
 
51
  EXPOSE 7860
52
 
53
+ # Uruchomienie aplikacji
54
  CMD ["python", "app.py"]