Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
73 changes: 73 additions & 0 deletions .github/workflows/dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
name: Build and Push Docker Images

on:
push:
branches:
- main
pull_request:
branches:
- "**"
workflow_dispatch:

permissions:
contents: read

env:
DOCKER_IMAGE: runpod/pod-template
DOCKER_PLATFORM: linux/amd64

jobs:
build-and-push:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Clean up runner disk space
run: |
echo "Cleaning up unnecessary folders to free disk space..."
rm -rf /usr/share/dotnet
rm -rf /opt/ghc
rm -rf /opt/hostedtoolcache/CodeQL
rm -rf "$AGENT_TOOLSDIRECTORY"
docker system prune -af || true
df -h

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build and push pip-based image
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile
platforms: ${{ env.DOCKER_PLATFORM }}
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ env.DOCKER_IMAGE }}:latest,${{ env.DOCKER_IMAGE }}:pip-latest
cache-from: type=gha
cache-to: type=gha,mode=max

- name: Clean up Docker and disk space between builds
run: |
echo "Cleaning up Docker and disk space..."
docker system prune -af
docker builder prune -af
rm -rf /tmp/*
df -h

- name: Build and push uv-based image
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile.uv
platforms: ${{ env.DOCKER_PLATFORM }}
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ env.DOCKER_IMAGE }}:uv-latest
cache-from: type=gha
cache-to: type=gha,mode=max
94 changes: 65 additions & 29 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,29 +1,65 @@
# Use Runpod PyTorch base image
FROM runpod/pytorch:1.0.2-cu1281-torch280-ubuntu2404

# Set environment variables
ENV PYTHONUNBUFFERED=1

# Set the working directory
WORKDIR /app

# Install system dependencies if needed
RUN apt-get update --yes && \
DEBIAN_FRONTEND=noninteractive apt-get install --yes --no-install-recommends \
wget \
&& rm -rf /var/lib/apt/lists/*

# Copy requirements file
COPY requirements.txt /app/

# Install Python dependencies with pip
# For uv alternative, see Dockerfile.uv
RUN pip install --no-cache-dir --upgrade pip && \
pip install --no-cache-dir -r requirements.txt

# Copy application files
COPY . /app

# Set the default command
CMD ["python", "main.py"]

# Use Runpod PyTorch base image
FROM runpod/pytorch:1.0.2-cu1281-torch280-ubuntu2404

# Set environment variables
ENV PYTHONUNBUFFERED=1

# Set the working directory
WORKDIR /app

# Install system dependencies if needed
RUN apt-get update --yes && \
DEBIAN_FRONTEND=noninteractive apt-get install --yes --no-install-recommends \
wget \
&& rm -rf /var/lib/apt/lists/*

# Copy requirements file
COPY requirements.txt /app/

# Install Python dependencies with pip
# For uv alternative, see Dockerfile.uv
RUN pip install --no-cache-dir --upgrade pip && \
pip install --no-cache-dir -r requirements.txt

# Copy application files
COPY . /app

# ============================================================================
# OPTION 1: Keep everything from base image (Jupyter, SSH, entrypoint) - DEFAULT
# ============================================================================
# The base image already provides everything:
# - Entrypoint: /opt/nvidia/nvidia_entrypoint.sh (handles CUDA setup)
# - Default CMD: /start.sh (starts Jupyter/SSH automatically based on template settings)
# - Jupyter Notebook (starts if startJupyter=true in template)
# - SSH access (starts if startSsh=true in template)
#
# Just don't override CMD - the base image handles everything!
# CMD is not set, so base image default (/start.sh) is used

# ============================================================================
# OPTION 2: Override CMD but keep entrypoint and services
# ============================================================================
# If you want to run your own command but still have Jupyter/SSH start:
# - Keep the entrypoint (CUDA setup still happens automatically)
# - Use the provided run.sh script which starts /start.sh in background,
# then runs your application commands
#
# Edit run.sh to customize what runs after services start, then uncomment:
# COPY run.sh /app/run.sh
# RUN chmod +x /app/run.sh
# CMD ["/app/run.sh"]
#
# The run.sh script:
# 1. Starts /start.sh in background (starts Jupyter/SSH)
# 2. Waits for services to initialize
# 3. Runs your application commands
# 4. Waits for background processes

# ============================================================================
# OPTION 3: Override everything - no Jupyter, no SSH, just your app
# ============================================================================
# If you don't want any base image services, override both entrypoint and CMD:
#
# ENTRYPOINT [] # Clear entrypoint
# CMD ["python", "/app/main.py"]

96 changes: 66 additions & 30 deletions Dockerfile.uv
Original file line number Diff line number Diff line change
@@ -1,30 +1,66 @@
# Use Runpod PyTorch base image
FROM runpod/pytorch:1.0.2-cu1281-torch280-ubuntu2404

# Set environment variables
ENV PYTHONUNBUFFERED=1

# Set the working directory
WORKDIR /app

# Install system dependencies if needed
RUN apt-get update --yes && \
DEBIAN_FRONTEND=noninteractive apt-get install --yes --no-install-recommends \
wget \
&& rm -rf /var/lib/apt/lists/*

# Install uv
RUN pip install --no-cache-dir uv

# Copy requirements file
COPY requirements.txt /app/

# Install Python dependencies with uv
RUN uv pip install --system --break-system-packages -r requirements.txt

# Copy application files
COPY . /app

# Set the default command
CMD ["python", "main.py"]

# Use Runpod PyTorch base image
FROM runpod/pytorch:1.0.2-cu1281-torch280-ubuntu2404

# Set environment variables
ENV PYTHONUNBUFFERED=1

# Set the working directory
WORKDIR /app

# Install system dependencies if needed
RUN apt-get update --yes && \
DEBIAN_FRONTEND=noninteractive apt-get install --yes --no-install-recommends \
wget \
&& rm -rf /var/lib/apt/lists/*

# Install uv
RUN pip install --no-cache-dir uv

# Copy requirements file
COPY requirements.txt /app/

# Install Python dependencies with uv
RUN uv pip install --system --break-system-packages -r requirements.txt

# Copy application files
COPY . /app

# ============================================================================
# OPTION 1: Keep everything from base image (Jupyter, SSH, entrypoint) - DEFAULT
# ============================================================================
# The base image already provides everything:
# - Entrypoint: /opt/nvidia/nvidia_entrypoint.sh (handles CUDA setup)
# - Default CMD: /start.sh (starts Jupyter/SSH automatically based on template settings)
# - Jupyter Notebook (starts if startJupyter=true in template)
# - SSH access (starts if startSsh=true in template)
#
# Just don't override CMD - the base image handles everything!
# CMD is not set, so base image default (/start.sh) is used

# ============================================================================
# OPTION 2: Override CMD but keep entrypoint and services
# ============================================================================
# If you want to run your own command but still have Jupyter/SSH start:
# - Keep the entrypoint (CUDA setup still happens automatically)
# - Use the provided run.sh script which starts /start.sh in background,
# then runs your application commands
#
# Edit run.sh to customize what runs after services start, then uncomment:
# COPY run.sh /app/run.sh
# RUN chmod +x /app/run.sh
# CMD ["/app/run.sh"]
#
# The run.sh script:
# 1. Starts /start.sh in background (starts Jupyter/SSH)
# 2. Waits for services to initialize
# 3. Runs your application commands
# 4. Waits for background processes

# ============================================================================
# OPTION 3: Override everything - no Jupyter, no SSH, just your app
# ============================================================================
# If you don't want any base image services, override both entrypoint and CMD:
#
# ENTRYPOINT [] # Clear entrypoint
# CMD ["python", "/app/main.py"]

Loading
Loading