Files
vw-api/Dockerfile
T
Thijs Herman 159eab5d1c chore: multi-arch Docker build (amd64, arm64, armv7) (#4)
* chore: multi-arch Docker build (amd64, arm64, armv7)

- Remove hardcoded GOARCH=amd64 from Dockerfile, use TARGETARCH ARG
- Add QEMU + buildx to CI for cross-compilation
- Build for linux/amd64, linux/arm64, linux/arm/v7

* chore: update action versions, add dependabot

- actions/checkout v4 → v6
- actions/setup-go v5 → v6
- Add dependabot.yml (monthly checks for Go, Actions, Docker)
2026-02-21 12:15:43 +01:00

35 lines
756 B
Docker

# Build stage
FROM golang:1.25-alpine AS builder
RUN apk add --no-cache git ca-certificates
WORKDIR /build
COPY go.mod go.sum ./
RUN go mod download
COPY . .
ARG TARGETOS=linux
ARG TARGETARCH=amd64
RUN CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build \
-ldflags="-s -w" \
-o /build/vaultwarden-api \
./cmd/api
# Runtime stage — pure Alpine, no Node.js
FROM alpine:3.21
RUN apk --no-cache add ca-certificates wget && \
adduser -D -H appuser
WORKDIR /app
COPY --from=builder /build/vaultwarden-api .
USER appuser
EXPOSE 8080
HEALTHCHECK --interval=30s --timeout=3s --start-period=10s --retries=3 \
CMD wget --no-verbose --tries=1 --spider http://localhost:8080/health || exit 1
ENTRYPOINT ["/app/vaultwarden-api"]