Skip to content

Instantly share code, notes, and snippets.

@gkmngrgn
Last active November 5, 2025 23:04
Show Gist options
  • Select an option

  • Save gkmngrgn/718af73ac964d1658990c1d4f6ac5639 to your computer and use it in GitHub Desktop.

Select an option

Save gkmngrgn/718af73ac964d1658990c1d4f6ac5639 to your computer and use it in GitHub Desktop.
Initial Docker Setup for Uv + Django
.git
.env
db.sqlite3
/static
FROM ghcr.io/astral-sh/uv:python3.13-alpine
# Set environment variables
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
# Set the working directory
WORKDIR /app
# Install dependencies
RUN apk add --no-cache gcc musl-dev libffi-dev curl
# Copy the application code
COPY . /app/
# Configure application
RUN uv run --no-dev manage.py collectstatic --noinput
# Expose the port the app runs on
EXPOSE 8000
# Command to run the application
CMD ["uv", "run", "--no-dev", "--group", "server", "python", "-m", "gunicorn", "app.asgi:application", "-k", "uvicorn_worker.UvicornWorker", "-b", "0.0.0.0:8000"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment