diff --git a/serverless/image-to-video/Dockerfile b/serverless/image-to-video/Dockerfile index 6f83da4..2add4c5 100644 --- a/serverless/image-to-video/Dockerfile +++ b/serverless/image-to-video/Dockerfile @@ -3,7 +3,8 @@ FROM nvidia/cuda:12.2.2-cudnn8-runtime-ubuntu22.04 # Set environment variables ENV PYTHONDONTWRITEBYTECODE=1 \ PYTHONUNBUFFERED=1 \ - PYTHONPATH=/app + PYTHONPATH=/app \ + PATH="/usr/local/bin:$PATH" # Set up working directory WORKDIR /app @@ -21,13 +22,16 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ build-essential \ && rm -rf /var/lib/apt/lists/* -# Create symbolic link for python -RUN ln -sf /usr/bin/python3.11 /usr/bin/python +# Create symbolic link for python and pip +RUN ln -sf /usr/bin/python3.11 /usr/bin/python && \ + ln -sf /usr/bin/pip3 /usr/bin/pip # Create user and set permissions RUN useradd -m -u 1000 user && \ chown -R user:user /app -USER user + +# Install base packages as root +RUN pip install --no-cache-dir -U pip setuptools wheel # Copy all required files and directories COPY --chown=user:user api/ /app/api/ @@ -35,15 +39,17 @@ COPY --chown=user:user scripts/ /app/scripts/ COPY --chown=user:user configs/ /app/configs/ COPY --chown=user:user setup.py /app/ - -# Install Python dependencies -RUN pip install --no-cache-dir -U pip setuptools wheel && \ - pip install --no-cache-dir -r api/requirements.txt && \ - pip install --no-cache-dir runpod && \ +# Install Python dependencies as root +RUN pip install --no-cache-dir -r api/requirements.txt && \ + pip install --no-cache-dir runpod==1.3.3 && \ pip install --no-cache-dir -e . -# Copy the handler (change this for each service) +# Switch to user after installations +USER user + COPY --chown=user:user serverless/image-to-video/run_image-to-video.py . -# Use full path to python +# Add verification step +RUN python -c "import runpod; print(f'RunPod version: {runpod.__version__}')" + CMD ["/usr/bin/python3.11", "run_image-to-video.py"] \ No newline at end of file diff --git a/serverless/inpainting/Dockerfile b/serverless/inpainting/Dockerfile index dd72c1b..c94ea15 100644 --- a/serverless/inpainting/Dockerfile +++ b/serverless/inpainting/Dockerfile @@ -3,7 +3,8 @@ FROM nvidia/cuda:12.2.2-cudnn8-runtime-ubuntu22.04 # Set environment variables ENV PYTHONDONTWRITEBYTECODE=1 \ PYTHONUNBUFFERED=1 \ - PYTHONPATH=/app + PYTHONPATH=/app \ + PATH="/usr/local/bin:$PATH" # Set up working directory WORKDIR /app @@ -21,13 +22,16 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ build-essential \ && rm -rf /var/lib/apt/lists/* -# Create symbolic link for python -RUN ln -sf /usr/bin/python3.11 /usr/bin/python +# Create symbolic link for python and pip +RUN ln -sf /usr/bin/python3.11 /usr/bin/python && \ + ln -sf /usr/bin/pip3 /usr/bin/pip # Create user and set permissions RUN useradd -m -u 1000 user && \ chown -R user:user /app -USER user + +# Install base packages as root +RUN pip install --no-cache-dir -U pip setuptools wheel # Copy all required files and directories COPY --chown=user:user api/ /app/api/ @@ -35,12 +39,17 @@ COPY --chown=user:user scripts/ /app/scripts/ COPY --chown=user:user configs/ /app/configs/ COPY --chown=user:user setup.py /app/ - -# Install Python dependencies -RUN pip install --no-cache-dir -U pip setuptools wheel && \ - pip install --no-cache-dir -r api/requirements.txt && \ - pip install --no-cache-dir runpod && \ +# Install Python dependencies as root +RUN pip install --no-cache-dir -r api/requirements.txt && \ + pip install --no-cache-dir runpod==1.3.3 && \ pip install --no-cache-dir -e . +# Switch to user after installations +USER user + COPY --chown=user:user serverless/inpainting/run_inpainting.py . + +# Add verification step +RUN python -c "import runpod; print(f'RunPod version: {runpod.__version__}')" + CMD ["/usr/bin/python3.11", "run_inpainting.py"] \ No newline at end of file diff --git a/serverless/outpainting/Dockerfile b/serverless/outpainting/Dockerfile index 51cb4e2..064feb2 100644 --- a/serverless/outpainting/Dockerfile +++ b/serverless/outpainting/Dockerfile @@ -3,7 +3,8 @@ FROM nvidia/cuda:12.2.2-cudnn8-runtime-ubuntu22.04 # Set environment variables ENV PYTHONDONTWRITEBYTECODE=1 \ PYTHONUNBUFFERED=1 \ - PYTHONPATH=/app + PYTHONPATH=/app \ + PATH="/usr/local/bin:$PATH" # Set up working directory WORKDIR /app @@ -21,13 +22,16 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ build-essential \ && rm -rf /var/lib/apt/lists/* -# Create symbolic link for python -RUN ln -sf /usr/bin/python3.11 /usr/bin/python +# Create symbolic link for python and pip +RUN ln -sf /usr/bin/python3.11 /usr/bin/python && \ + ln -sf /usr/bin/pip3 /usr/bin/pip # Create user and set permissions RUN useradd -m -u 1000 user && \ chown -R user:user /app -USER user + +# Install base packages as root +RUN pip install --no-cache-dir -U pip setuptools wheel # Copy all required files and directories COPY --chown=user:user api/ /app/api/ @@ -35,15 +39,17 @@ COPY --chown=user:user scripts/ /app/scripts/ COPY --chown=user:user configs/ /app/configs/ COPY --chown=user:user setup.py /app/ - -# Install Python dependencies -RUN pip install --no-cache-dir -U pip setuptools wheel && \ - pip install --no-cache-dir -r api/requirements.txt && \ - pip install --no-cache-dir runpod && \ +# Install Python dependencies as root +RUN pip install --no-cache-dir -r api/requirements.txt && \ + pip install --no-cache-dir runpod==1.3.3 && \ pip install --no-cache-dir -e . -# Copy the handler (change this for each service) +# Switch to user after installations +USER user + COPY --chown=user:user serverless/outpainting/run_outpainting.py . -# Use full path to python +# Add verification step +RUN python -c "import runpod; print(f'RunPod version: {runpod.__version__}')" + CMD ["/usr/bin/python3.11", "run_outpainting.py"] \ No newline at end of file diff --git a/serverless/text-to-image/Dockerfile b/serverless/text-to-image/Dockerfile index faf7308..0d2ee53 100644 --- a/serverless/text-to-image/Dockerfile +++ b/serverless/text-to-image/Dockerfile @@ -3,7 +3,8 @@ FROM nvidia/cuda:12.2.2-cudnn8-runtime-ubuntu22.04 # Set environment variables ENV PYTHONDONTWRITEBYTECODE=1 \ PYTHONUNBUFFERED=1 \ - PYTHONPATH=/app + PYTHONPATH=/app \ + PATH="/usr/local/bin:$PATH" # Set up working directory WORKDIR /app @@ -21,13 +22,16 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ build-essential \ && rm -rf /var/lib/apt/lists/* -# Create symbolic link for python -RUN ln -sf /usr/bin/python3.11 /usr/bin/python +# Create symbolic link for python and pip +RUN ln -sf /usr/bin/python3.11 /usr/bin/python && \ + ln -sf /usr/bin/pip3 /usr/bin/pip # Create user and set permissions RUN useradd -m -u 1000 user && \ chown -R user:user /app -USER user + +# Install base packages as root +RUN pip install --no-cache-dir -U pip setuptools wheel # Copy all required files and directories COPY --chown=user:user api/ /app/api/ @@ -35,15 +39,17 @@ COPY --chown=user:user scripts/ /app/scripts/ COPY --chown=user:user configs/ /app/configs/ COPY --chown=user:user setup.py /app/ - -# Install Python dependencies -RUN pip install --no-cache-dir -U pip setuptools wheel && \ - pip install --no-cache-dir -r api/requirements.txt && \ - pip install --no-cache-dir runpod && \ +# Install Python dependencies as root +RUN pip install --no-cache-dir -r api/requirements.txt && \ + pip install --no-cache-dir runpod==1.3.3 && \ pip install --no-cache-dir -e . -# Copy the handler (change this for each service) +# Switch to user after installations +USER user + COPY --chown=user:user serverless/text-to-image/run_text-to-image.py . -# Use full path to python +# Add verification step +RUN python -c "import runpod; print(f'RunPod version: {runpod.__version__}')" + CMD ["/usr/bin/python3.11", "run_text-to-image.py"] \ No newline at end of file