well-api/Dockerfile
2025-08-14 21:54:37 -07:00

45 lines
1.2 KiB
Docker

FROM python:3.9-slim
# Install system dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
gcc \
python3-dev \
libglib2.0-0 \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
# Install Python dependencies with headless OpenCV
COPY requirements.txt requirements_temp.txt
# Replace opencv-python with opencv-python-headless
RUN sed 's/opencv-python/opencv-python-headless/g' requirements_temp.txt > requirements_fixed.txt
RUN pip install --no-cache-dir -r requirements_fixed.txt
# Copy and build the C extension
COPY simplified_filter_short_groups.c /app/
COPY direct_setup.py /app/
RUN python direct_setup.py install
# Copy the wrapper module
COPY filter_short_groups_wrapper.py /app/
# Copy application code
COPY well-api.py .
# Create directory and copy data files
RUN mkdir -p /home/app/well_web_storage
COPY well_web_files/* /home/app/well_web_storage/
RUN mkdir -p /app/fonts
COPY fonts/* /app/fonts/
# Environment variables for gunicorn
ENV GUNICORN_CMD_ARGS="--log-level info --timeout 60"
ENV PYTHONUNBUFFERED=1
ENV PYTHONDONTWRITEBYTECODE=1
# Expose the port for the API
EXPOSE 8080
# Run with gunicorn
CMD ["gunicorn", "--bind", "0.0.0.0:8080", "well-api:app"]