forked from vxcontrol/pentagi
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
161 lines (129 loc) · 4.74 KB
/
Copy pathDockerfile
File metadata and controls
161 lines (129 loc) · 4.74 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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
# syntax=docker/dockerfile:1.4
# STEP 1: Build the frontend
FROM node:23-slim as fe-build
ENV NODE_ENV=production
ENV VITE_BUILD_MEMORY_LIMIT=4096
ENV NODE_OPTIONS="--max-old-space-size=4096"
WORKDIR /frontend
# Install build essentials
RUN apt-get update && apt-get install -y \
ca-certificates \
tzdata \
gcc \
g++ \
make \
git
COPY ./backend/pkg/graph/schema.graphqls ../backend/pkg/graph/
COPY frontend/ .
# Install dependencies with package manager detection for SBOM
RUN --mount=type=cache,target=/root/.npm \
npm ci --include=dev
# Build frontend with optimizations and parallel processing
RUN npm run build -- \
--mode production \
--minify esbuild \
--outDir dist \
--emptyOutDir \
--sourcemap false \
--target es2020
# STEP 2: Build the backend
FROM golang:1.24-bookworm as be-build
# Build arguments for version information
ARG PACKAGE_VER=develop
ARG PACKAGE_REV=
ENV CGO_ENABLED=0
ENV GO111MODULE=on
# Install build essentials
RUN apt-get update && apt-get install -y \
ca-certificates \
tzdata \
gcc \
g++ \
make \
git \
musl-dev
WORKDIR /backend
COPY backend/ .
# Download dependencies with module detection for SBOM
RUN --mount=type=cache,target=/go/pkg/mod \
go mod download
# Build backend with version information
RUN go build -trimpath \
-ldflags "\
-X pentagi/pkg/version.PackageName=pentagi \
-X pentagi/pkg/version.PackageVer=${PACKAGE_VER} \
-X pentagi/pkg/version.PackageRev=${PACKAGE_REV}" \
-o /pentagi ./cmd/pentagi
# Build ctester utility
RUN go build -trimpath \
-ldflags "\
-X pentagi/pkg/version.PackageName=ctester \
-X pentagi/pkg/version.PackageVer=${PACKAGE_VER} \
-X pentagi/pkg/version.PackageRev=${PACKAGE_REV}" \
-o /ctester ./cmd/ctester
# Build ftester utility
RUN go build -trimpath \
-ldflags "\
-X pentagi/pkg/version.PackageName=ftester \
-X pentagi/pkg/version.PackageVer=${PACKAGE_VER} \
-X pentagi/pkg/version.PackageRev=${PACKAGE_REV}" \
-o /ftester ./cmd/ftester
# Build etester utility
RUN go build -trimpath \
-ldflags "\
-X pentagi/pkg/version.PackageName=etester \
-X pentagi/pkg/version.PackageVer=${PACKAGE_VER} \
-X pentagi/pkg/version.PackageRev=${PACKAGE_REV}" \
-o /etester ./cmd/etester
# STEP 3: Build the final image
FROM alpine:3.23.3
# Create non-root user and docker group with specific GID
RUN addgroup -g 998 docker && \
addgroup -S pentagi && \
adduser -S pentagi -G pentagi && \
addgroup pentagi docker
# Install required packages
RUN apk --no-cache add ca-certificates openssl openssh-keygen shadow
ADD scripts/entrypoint.sh /opt/pentagi/bin/
RUN sed -i 's/\r//' /opt/pentagi/bin/entrypoint.sh && \
chmod +x /opt/pentagi/bin/entrypoint.sh
RUN mkdir -p \
/root/.ollama \
/opt/pentagi/bin \
/opt/pentagi/ssl \
/opt/pentagi/fe \
/opt/pentagi/logs \
/opt/pentagi/data \
/opt/pentagi/conf && \
chmod 777 /root/.ollama
COPY --from=be-build /pentagi /opt/pentagi/bin/pentagi
COPY --from=be-build /ctester /opt/pentagi/bin/ctester
COPY --from=be-build /ftester /opt/pentagi/bin/ftester
COPY --from=be-build /etester /opt/pentagi/bin/etester
COPY --from=fe-build /frontend/dist /opt/pentagi/fe
# Copy provider configuration files
COPY examples/configs/custom-openai.provider.yml /opt/pentagi/conf/
COPY examples/configs/deepinfra.provider.yml /opt/pentagi/conf/
COPY examples/configs/deepseek.provider.yml /opt/pentagi/conf/
COPY examples/configs/moonshot.provider.yml /opt/pentagi/conf/
COPY examples/configs/ollama-llama318b-instruct.provider.yml /opt/pentagi/conf/
COPY examples/configs/ollama-llama318b.provider.yml /opt/pentagi/conf/
COPY examples/configs/ollama-qwen332b-fp16-tc.provider.yml /opt/pentagi/conf/
COPY examples/configs/ollama-qwq32b-fp16-tc.provider.yml /opt/pentagi/conf/
COPY examples/configs/openrouter.provider.yml /opt/pentagi/conf/
COPY examples/configs/novita.provider.yml /opt/pentagi/conf/
COPY examples/configs/vllm-qwen3.5-27b-fp8.provider.yml /opt/pentagi/conf/
COPY examples/configs/vllm-qwen332b-fp16.provider.yml /opt/pentagi/conf/
COPY LICENSE /opt/pentagi/LICENSE
COPY NOTICE /opt/pentagi/NOTICE
COPY EULA.md /opt/pentagi/EULA
COPY EULA.md /opt/pentagi/fe/EULA.md
RUN chown -R pentagi:pentagi /opt/pentagi
WORKDIR /opt/pentagi
USER pentagi
ENTRYPOINT ["/opt/pentagi/bin/entrypoint.sh", "/opt/pentagi/bin/pentagi"]
# Image Metadata
LABEL org.opencontainers.image.source="https://github.com/vxcontrol/pentagi"
LABEL org.opencontainers.image.description="Fully autonomous AI Agents system capable of performing complex penetration testing tasks"
LABEL org.opencontainers.image.authors="PentAGI Development Team"
LABEL org.opencontainers.image.licenses="MIT License"