optimize: use pre-built PyTorch base image for worker to reduce build overhead
Build and Push Docker Images / build (api) (push) Successful in 1m52s Details
Build and Push Docker Images / build (web) (push) Successful in 2m17s Details
Build and Push Docker Images / build (worker) (push) Successful in 11m26s Details
Build and Push Docker Images / deploy (push) Failing after 2m25s Details

This commit is contained in:
fchinembiri 2026-05-08 18:25:19 +02:00
parent 39abc55f05
commit fd931f1cfc
1 changed files with 11 additions and 3 deletions

View File

@ -1,6 +1,10 @@
FROM python:3.11-slim
# Use pre-built PyTorch image to avoid massive downloads and build overhead
FROM pytorch/pytorch:2.1.1-cuda12.1-cudnn8-runtime
# Install system dependencies required by rasterio and other packages
# Set non-interactive for apt
ENV DEBIAN_FRONTEND=noninteractive
# Install system dependencies and clean up in one layer
RUN apt-get update && apt-get install -y --no-install-recommends \
libexpat1 \
libgomp1 \
@ -10,6 +14,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
libspatialindex-dev \
libcurl4-openssl-dev \
libssl-dev \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
@ -17,10 +22,13 @@ WORKDIR /app
# Set Python path to include /app
ENV PYTHONPATH=/app
# Copy requirements and install dependencies
# We use --no-cache-dir to keep the image small
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Copy the application code
COPY . .
# Start the RQ worker to listen for jobs on the geocrop_tasks queue
# Start the RQ worker
CMD ["python", "worker.py", "--worker"]