This repository was archived by the owner on Nov 5, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathDockerfile.worker
More file actions
59 lines (43 loc) · 1.52 KB
/
Dockerfile.worker
File metadata and controls
59 lines (43 loc) · 1.52 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
# Multi-stage build for AgentFlow Worker
FROM golang:1.24-alpine AS builder
# Install build dependencies
RUN apk add --no-cache git ca-certificates tzdata
# Set working directory
WORKDIR /app
# Copy go mod files
COPY go.mod go.sum ./
# Download dependencies
RUN go mod download
# Copy source code
COPY . .
# Build the worker binary
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o worker ./cmd/worker
# Final stage
FROM alpine:3.18
# Install runtime dependencies and tools for WASI/containers
RUN apk --no-cache add ca-certificates tzdata curl wget bash
# Install wasmtime for WASI support using the install script with workaround
RUN mkdir -p ~/.config && \
touch ~/.profile && \
curl -sSf https://wasmtime.dev/install.sh | bash -s -- --version v15.0.1 && \
cp ~/.wasmtime/bin/wasmtime /usr/local/bin/ && \
chmod +x /usr/local/bin/wasmtime && \
rm -rf ~/.wasmtime && \
echo "Wasmtime installed successfully"
# Create non-root user
RUN addgroup -g 1001 agentflow && \
adduser -D -s /bin/sh -u 1001 -G agentflow agentflow
# Set working directory
WORKDIR /app
# Copy binary from builder stage
COPY --from=builder /app/worker .
# Create directories for configs, data, and function execution
RUN mkdir -p /app/configs /app/data /app/functions /app/tmp && \
chown -R agentflow:agentflow /app
# Switch to non-root user
USER agentflow
# Health check
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
CMD pgrep -f worker || exit 1
# Set entrypoint
ENTRYPOINT ["./worker"]