beszel / Dockerfile
cacodex's picture
Build Beszel frontend before hub binary
4fda9dd verified
Raw History Blame Contribute Delete
829 Bytes
FROM node:22-alpine AS site-builder
WORKDIR /site
COPY src/internal/site/package.json src/internal/site/package-lock.json ./
RUN npm ci
COPY src/internal/site ./
RUN npm run build
FROM --platform=$BUILDPLATFORM golang:alpine AS builder
WORKDIR /app
RUN apk add --no-cache ca-certificates
COPY src/go.mod src/go.sum ./
RUN go mod download
COPY src/ ./
COPY --from=site-builder /site/dist ./internal/site/dist
ARG TARGETOS TARGETARCH
RUN CGO_ENABLED=0 GOGC=75 GOOS=${TARGETOS:-linux} GOARCH=${TARGETARCH:-amd64} go build -ldflags "-w -s" -o /beszel ./internal/cmd/hub
FROM scratch
COPY --from=builder /beszel /
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
EXPOSE 8090
CMD ["/beszel", "serve", "--http=0.0.0.0:8090", "--dir=/tmp/beszel_data", "--encryptionEnv=BESZEL_SETTINGS_ENCRYPTION_KEY"]