-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.prebuilt
More file actions
42 lines (29 loc) · 1.12 KB
/
Dockerfile.prebuilt
File metadata and controls
42 lines (29 loc) · 1.12 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
# Production image using pre-compiled binary (zig cross-compiled for linux/amd64).
# Build the binary first:
# CC="zig cc -target x86_64-linux-musl" CXX="zig c++ -target x86_64-linux-musl" \
# CGO_ENABLED=1 GOOS=linux GOARCH=amd64 \
# go build -mod=vendor -ldflags="-s -w -extldflags '-static'" -o commerce ./cmd/commerce/main.go
FROM alpine:3.21
LABEL org.opencontainers.image.source="https://github.com/hanzoai/commerce"
# Install runtime dependencies
RUN apk add --no-cache ca-certificates tzdata curl
# Create non-root user
RUN addgroup -S hanzo && adduser -S hanzo -G hanzo
WORKDIR /app
# Copy pre-built static binary
COPY commerce /app/commerce
# Copy templates and static assets
COPY templates /app/templates
COPY api/templates /app/api/templates
# Create data directories
RUN mkdir -p /app/data /app/logs && \
chown -R hanzo:hanzo /app
USER hanzo
EXPOSE 8001
ENV COMMERCE_DIR=/app/data
ENV COMMERCE_DEV=false
ENV PORT=8001
HEALTHCHECK --interval=30s --timeout=10s --start-period=10s --retries=3 \
CMD curl -f http://localhost:8001/healthz || exit 1
ENTRYPOINT ["/app/commerce"]
CMD ["serve", "0.0.0.0:8001"]