-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathDockerfile
More file actions
54 lines (45 loc) · 2.2 KB
/
Copy pathDockerfile
File metadata and controls
54 lines (45 loc) · 2.2 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
50
51
52
53
54
# ────────────────────────────────────────────────────────────────
# Dockerfile - production image for agent-generator v1.0.0
# ────────────────────────────────────────────────────────────────
#
# $ docker build -t agent-generator:latest .
# $ docker run -e WATSONX_API_KEY=... -p 8000:8000 agent-generator:latest
#
# The container launches a Uvicorn server exposing the FastAPI Web UI
# at http://localhost:8000. The CLI is also available inside the
# container (`docker run --rm agent-generator agent-generator --help`).
# ------------------------------------------------------------------
FROM python:3.11-alpine AS base
# -------------------------------------------------
# Essential build tools (compile wheels)
# -------------------------------------------------
RUN apk add --no-cache --virtual .build-deps \
gcc musl-dev libffi-dev openssl-dev
# -------------------------------------------------
# Virtualenv
# -------------------------------------------------
ENV VENV_PATH="/opt/venv"
RUN python -m venv ${VENV_PATH}
ENV PATH="${VENV_PATH}/bin:$PATH"
# -------------------------------------------------
# Copy source and install
# -------------------------------------------------
WORKDIR /app
COPY pyproject.toml README.md LICENSE /app/
COPY src /app/src
RUN pip install --upgrade pip && \
pip install "."
# -------------------------------------------------
# Clean build deps to slim image
# -------------------------------------------------
RUN apk del .build-deps
# -------------------------------------------------
# Healthcheck
# -------------------------------------------------
HEALTHCHECK --interval=30s --timeout=3s --start-period=15s CMD wget -qO- http://localhost:8000/health || exit 1
# -------------------------------------------------
# Runtime configuration
# -------------------------------------------------
ENV PORT=8000
EXPOSE ${PORT}
CMD ["uvicorn", "agent_generator.wsgi:app", "--host", "0.0.0.0", "--port", "8000", "--workers", "4"]