Skip to content

Instantly share code, notes, and snippets.

@pythoninthegrass
Last active August 26, 2025 01:06
Show Gist options
  • Save pythoninthegrass/32524ce7da5066c9e7f8b607cf263646 to your computer and use it in GitHub Desktop.
Save pythoninthegrass/32524ce7da5066c9e7f8b607cf263646 to your computer and use it in GitHub Desktop.
dockerpyze config and edited dockerfile
# syntax=docker/dockerfile:1.17.1
FROM python:3.12-slim AS builder
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
ARG DEBIAN_FRONTEND=noninteractive
RUN <<-EOF
cat > /etc/apt/apt.conf.d/99timeout_and_retries <<- APT_CONF
Acquire::http::Timeout "30";
Acquire::http::ConnectionAttemptDelayMsec "2000";
Acquire::https::Timeout "30";
Acquire::https::ConnectionAttemptDelayMsec "2000";
Acquire::ftp::Timeout "30";
Acquire::ftp::ConnectionAttemptDelayMsec "2000";
Acquire::Retries "15";
APT_CONF
apt-get update
apt-get -y dist-upgrade
apt-get -y install gcc
EOF
WORKDIR /app
COPY pyproject.toml uv.lock* /app/
COPY *.py /app/
RUN cd /app \
&& uv sync
FROM python:3.12-slim AS runner
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
ENV PATH="/app/.venv/bin:$PATH"
ENV PYTHONUNBUFFERED=1
WORKDIR /app
COPY --from=builder /app/.venv /app/.venv
COPY --from=builder /app/*.py /app/
ENV PYTHONPATH="/app"
CMD ["uv", "run", "server.py"]
LABEL org.opencontainers.image.title=ghcr.io/pythoninthegrass/test
LABEL org.opencontainers.image.version=0.1.0
LABEL org.opencontainers.image.authors=['pythoninthegrass <[email protected]>']
LABEL org.opencontainers.image.licenses=Unlicense
LABEL org.opencontainers.image.url=https://github.com/pythoninthegrass/test
LABEL org.opencontainers.image.source=https://github.com/pythoninthegrass/test
[project]
name = "test"
version = "0.1.0"
authors = [
{ name = "pythoninthegrass", email = "[email protected]" }
]
requires-python = ">=3.12,<3.13"
dependencies = [
"python-decouple>=3.8",
"sh>=2.2.2",
]
[project.optional-dependencies]
dev = [
"dockerpyze>=2.2.0",
]
[tool.dpy]
name = "ghcr.io/pythoninthegrass/test"
python = "3.12"
base-image = "python:3.12-slim"
platform = "linux/arm64"
entrypoint = "uv run server.py"
[tool.dpy.labels]
"org.opencontainers.image.title" = "ghcr.io/pythoninthegrass/test"
"org.opencontainers.image.licenses" = "Unlicense"
"org.opencontainers.image.url" = "https://github.com/pythoninthegrass/test"
"org.opencontainers.image.source" = "https://github.com/pythoninthegrass/test"
@pythoninthegrass
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment