Repository navigation
Expand file tree
/
Copy pathDockerfile.frontend
More file actions
62 lines (52 loc) · 2.57 KB
/
Copy pathDockerfile.frontend
File metadata and controls
62 lines (52 loc) · 2.57 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
55
56
57
58
59
60
61
62
# syntax=docker/dockerfile:1.7
ARG BUN_IMAGE=oven/bun:1.3.14-slim@sha256:d56a2534ffd262e92c12fd3249d3924d296d97086da773f821d7d0477435ea04
ARG NODE_IMAGE=node:24.13.1-bookworm-slim@sha256:a81a03dd965b4052269a57fac857004022b522a4bf06e7a739e25e18bce45af2
FROM ${BUN_IMAGE} AS dependencies
WORKDIR /app
COPY frontend/package.json frontend/bun.lock ./frontend/
COPY packages/agent-client/package.json ./packages/agent-client/
COPY packages/agent-harness/package.json ./packages/agent-harness/
COPY packages/artifact-workspace/package.json ./packages/artifact-workspace/
WORKDIR /app/frontend
RUN bun install --frozen-lockfile
FROM ${NODE_IMAGE} AS build
ARG RELEASE_COMMIT
RUN echo "${RELEASE_COMMIT}" | grep -Eq '^[0-9a-f]{40}$'
ENV NEXT_PUBLIC_USEAGENT_RELEASE_COMMIT=${RELEASE_COMMIT}
# Client execution-graph kill switch, a build-time input: on unless a build passes off.
ARG NEXT_PUBLIC_EXECUTION_GRAPH_ROLLOUT=read
ENV NEXT_PUBLIC_EXECUTION_GRAPH_ROLLOUT=${NEXT_PUBLIC_EXECUTION_GRAPH_ROLLOUT}
WORKDIR /app
COPY --from=dependencies /app/frontend/node_modules ./frontend/node_modules
COPY frontend ./frontend
COPY packages/agent-client ./packages/agent-client
COPY packages/agent-harness ./packages/agent-harness
COPY packages/artifact-workspace ./packages/artifact-workspace
RUN ln -s frontend/node_modules /app/node_modules \
&& for package in agent-client agent-harness artifact-workspace; do \
rm -rf "/app/frontend/node_modules/@useagent/${package}"; \
ln -s "../../../packages/${package}" "/app/frontend/node_modules/@useagent/${package}"; \
done \
&& cd frontend \
&& node node_modules/next/dist/bin/next build
FROM ${NODE_IMAGE} AS runtime
ARG RELEASE_COMMIT
RUN echo "${RELEASE_COMMIT}" | grep -Eq '^[0-9a-f]{40}$'
LABEL org.opencontainers.image.source="https://github.com/useagenthq/useagent" \
org.opencontainers.image.revision="${RELEASE_COMMIT}" \
org.opencontainers.image.title="useAgent frontend" \
io.useagent.auth="better-auth"
ENV NODE_ENV=production \
HOSTNAME=0.0.0.0 \
PORT=3400 \
NEXT_PUBLIC_USEAGENT_RELEASE_COMMIT=${RELEASE_COMMIT}
WORKDIR /app
COPY --from=build /app/frontend/.next-build/standalone ./
COPY --from=build /app/frontend/.next-build/static ./frontend/.next-build/static
COPY --from=build /app/frontend/public ./frontend/public
USER node
WORKDIR /app/frontend
EXPOSE 3400
HEALTHCHECK --interval=5s --timeout=3s --start-period=15s --retries=12 \
CMD ["node", "-e", "fetch('http://127.0.0.1:'+(process.env.PORT||'3400')+'/healthz').then(r=>{if(!r.ok)process.exit(1)}).catch(()=>process.exit(1))"]
CMD ["node", "server.js"]