-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.api
More file actions
49 lines (39 loc) · 1.43 KB
/
Dockerfile.api
File metadata and controls
49 lines (39 loc) · 1.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# syntax=docker/dockerfile:1.7
# Test/Dev-grade container for FBA-Bench API
# - Uses Poetry to install ALL dependencies (including dev/test)
# - Runs as root (for simplicity in CI/test environments, or match user in compose)
# - Exposes 8000
FROM python:3.11-slim AS base
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1 \
PIP_NO_CACHE_DIR=1 \
POETRY_VERSION=1.8.3 \
POETRY_VIRTUALENVS_CREATE=false
# System dependencies for common wheels and build
RUN apt-get update -y \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
build-essential \
curl \
libffi-dev \
libpq-dev \
gcc \
&& rm -rf /var/lib/apt/lists/*
# Install Poetry
RUN python -m pip install --upgrade pip setuptools wheel \
&& python -m pip install "poetry==${POETRY_VERSION}"
WORKDIR /app
ENV PYTHONPATH=/app/src
# Leverage Docker layer caching: copy manifestation first
COPY pyproject.toml ./
COPY README.md ./
# Install ALL dependencies (main + dev + test)
RUN poetry install --no-interaction --no-ansi --no-root
# Manually install missing dependencies
RUN pip install opentelemetry-api opentelemetry-sdk opentelemetry-instrumentation-fastapi
# Copy source code and configuration
COPY src/ ./src/
COPY alembic/ ./alembic/
COPY alembic.ini ./
COPY api_server.py ./
# Tests will be mounted, default command runs server
CMD ["python", "-m", "uvicorn", "api_server:app", "--host", "0.0.0.0", "--port", "8000"]