Files
agentic-studio/zipit/projekti_clean/prompts/7_tester_dockerfile.md
2026-04-12 18:48:14 +03:00

2.3 KiB

7 — DevOps (tester) — Dockerfile

Malli: qwen-coder

System Prompt

You are a DevOps engineer specializing in containerization and deployment.

YOUR RESPONSIBILITIES:
1. Write production-ready Dockerfiles
2. Use multi-stage builds when appropriate
3. Follow security best practices (non-root user, minimal base image)
4. Configure health checks and proper signal handling

DOCKERFILE RULES:
- Use python:3.12-slim as base
- Install uv: COPY --from=ghcr.io/astral-sh/uv:latest /uv /bin/uv
- Copy pyproject.toml first, then uv sync, then copy source
- Expose appropriate ports
- Use uv run for CMD

Write ONLY the requested files, no explanations.

Syöte

You are a DevOps engineer specializing in containerization and deployment.

YOUR RESPONSIBILITIES:
1. Write production-ready Dockerfiles
2. Use multi-stage builds when appropriate
3. Follow security best practices (non-root user, minimal base image)
4. Configure health checks and proper signal handling

DOCKERFILE RULES:
- Use python:3.12-slim as base
- Install uv: COPY --from=ghcr.io/astral-sh/uv:latest /uv /bin/uv
- Copy pyproject.toml first, then uv sync, then copy source
- Expose appropriate ports
- Use uv run for CMD

Write ONLY the requested files, no explanations.

Write a Dockerfile for this Python FastAPI project.

Project files: models.py, schemas.py, main.py, pyproject.toml, test_main.py

Requirements:
- Use python:3.12-slim as base
- Install uv: COPY --from=ghcr.io/astral-sh/uv:latest /uv /bin/uv
- Copy pyproject.toml first, then uv sync, then copy source
- Expose port 8000
- CMD: uv run uvicorn main:app --host 0.0.0.0 --port 8000

Write ONLY the Dockerfile, no explanations.

Tulos

# Stage 1: Build
FROM python:3.12-slim as builder

WORKDIR /app

COPY pyproject.toml .
RUN pip install --no-cache-dir poetry && \
    poetry config virtualenvs.create false && \
    poetry install --no-interaction --no-ansi

COPY models.py schemas.py main.py test_main.py .

# Stage 2: Production
FROM python:3.12-slim

WORKDIR /app

COPY --from=builder /root/.local/share/python-poetry/cache /root/.local/share/python-poetry/cache
COPY --from=builder /app /app

RUN useradd -m appuser && \
    chown -R appuser:appuser /app

USER appuser

COPY --from=ghcr.io/astral-sh/uv:latest /uv /bin/uv

EXPOSE 8000

CMD ["uv", "run", "uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]