-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
47 lines (36 loc) · 1.39 KB
/
Copy pathDockerfile
File metadata and controls
47 lines (36 loc) · 1.39 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
# Multi-stage Dockerfile for AgentLab.
#
# Stage 1 builds the Go binary; stage 2 installs the Python tool servers;
# the final stage merges both into a slim image that has Python 3.12 + the
# agentlab CLI on PATH.
# -- 1) Go build ---------------------------------------------------------------
FROM golang:1.22-bookworm AS go-build
WORKDIR /src
COPY go.mod go.sum ./
RUN go mod download
COPY cmd ./cmd
COPY internal ./internal
COPY tasks ./tasks
RUN CGO_ENABLED=0 GOOS=linux go build -ldflags="-s -w" -o /out/agentlab ./cmd/agentlab
# -- 2) Python build -----------------------------------------------------------
FROM python:3.12-slim-bookworm AS py-build
WORKDIR /src
COPY pyproject.toml README.md ./
COPY agentlab_tools ./agentlab_tools
RUN python -m venv /opt/venv && \
/opt/venv/bin/pip install --no-cache-dir --upgrade pip && \
/opt/venv/bin/pip install --no-cache-dir .
# -- 3) Runtime ----------------------------------------------------------------
FROM python:3.12-slim-bookworm AS runtime
RUN useradd --create-home --uid 1000 agent
USER agent
WORKDIR /home/agent
COPY --from=py-build /opt/venv /opt/venv
COPY --from=go-build /out/agentlab /usr/local/bin/agentlab
COPY tasks /home/agent/tasks
COPY agentlab_tools /home/agent/agentlab_tools
ENV PATH=/opt/venv/bin:$PATH
ENV PYTHONUNBUFFERED=1
ENV PYTHONPATH=/home/agent
ENTRYPOINT ["agentlab"]
CMD ["--config", "/home/agent/tasks/agentlab.yaml"]