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
5 changes: 4 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,11 @@ RUN DEBIAN_FRONTEND=noninteractive apt-get update && apt-get install -y --no-ins
# Use --python to target the active interpreter (preserves torch in its site-packages)
COPY README.md pyproject.toml uv.lock ./
COPY src/ ./
# Precompile bytecode at build time: a fresh container otherwise recompiles
# every imported module on first import, on every cold start.
RUN uv export --format requirements-txt --no-dev --no-hashes > requirements.txt \
&& uv pip install --python $(which python) --break-system-packages -r requirements.txt
&& uv pip install --compile-bytecode --python $(which python) --break-system-packages -r requirements.txt \
&& python -m compileall -q .

# Install numpy for the active Python version.
# The runpod/pytorch image ships torch but not numpy. Flash build excludes numpy
Expand Down
5 changes: 4 additions & 1 deletion Dockerfile-cpu
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,10 @@ RUN DEBIAN_FRONTEND=noninteractive apt-get update && apt-get install -y --no-ins
# Copy app code and install dependencies
COPY README.md pyproject.toml uv.lock ./
COPY src/ ./
# Precompile bytecode at build time: a fresh container otherwise recompiles
# every imported module on first import, on every cold start.
RUN uv export --format requirements-txt --no-dev --no-hashes > requirements.txt \
&& uv pip install --system --break-system-packages -r requirements.txt
&& uv pip install --compile-bytecode --system --break-system-packages -r requirements.txt \
&& python -m compileall -q .

CMD ["python", "handler.py"]
5 changes: 4 additions & 1 deletion Dockerfile-lb
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,11 @@ RUN DEBIAN_FRONTEND=noninteractive apt-get update && apt-get install -y --no-ins
# Use --python to target the active interpreter (preserves torch in its site-packages)
COPY README.md pyproject.toml uv.lock ./
COPY src/ ./
# Precompile bytecode at build time: a fresh container otherwise recompiles
# every imported module on first import, on every cold start.
RUN uv export --format requirements-txt --no-dev --no-hashes > requirements.txt \
&& uv pip install --python $(which python) --break-system-packages -r requirements.txt
&& uv pip install --compile-bytecode --python $(which python) --break-system-packages -r requirements.txt \
&& python -m compileall -q .

# Install numpy for the active Python version.
# The runpod/pytorch image ships torch but not numpy. Flash build excludes numpy
Expand Down
5 changes: 4 additions & 1 deletion Dockerfile-lb-cpu
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,11 @@ RUN DEBIAN_FRONTEND=noninteractive apt-get update && apt-get install -y --no-ins
# Copy app code and install dependencies
COPY README.md pyproject.toml uv.lock ./
COPY src/ ./
# Precompile bytecode at build time: a fresh container otherwise recompiles
# every imported module on first import, on every cold start.
RUN uv export --format requirements-txt --no-dev --no-hashes > requirements.txt \
&& uv pip install --system --break-system-packages -r requirements.txt
&& uv pip install --compile-bytecode --system --break-system-packages -r requirements.txt \
&& python -m compileall -q .

EXPOSE 80

Expand Down
Loading