feat: add Docker configuration for containerized deployment

This commit is contained in:
Andrew 2026-03-15 15:02:08 +07:00
parent f29dcad16e
commit 80fe7a99f0
4 changed files with 173 additions and 0 deletions

38
Dockerfile Normal file
View file

@ -0,0 +1,38 @@
# GIS Classification - Docker Image
FROM python:3.11-slim
# Set working directory
WORKDIR /app
# Install system dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
gdal-bin \
libgdal-dev \
libgeos-dev \
libproj-dev \
&& rm -rf /var/lib/apt/lists/*
# Set GDAL environment variables
ENV GDAL_VERSION=3.6.2
# Copy requirements first for better caching
COPY requirements.txt .
# Install Python dependencies
RUN pip install --no-cache-dir -r requirements.txt
# Copy application code
COPY . .
# Create necessary directories
RUN mkdir -p /app/data /app/output /app/static
# Expose port
EXPOSE 8000
# Set environment variables
ENV PYTHONUNBUFFERED=1
ENV PYTHONDONTWRITEBYTECODE=1
# Run the application
CMD ["uvicorn", "src.api:app", "--host", "0.0.0.0", "--port", "8000"]