Repository navigation
Expand file tree
/
Copy pathDockerfile
More file actions
48 lines (41 loc) · 1.45 KB
/
Copy pathDockerfile
File metadata and controls
48 lines (41 loc) · 1.45 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
FROM node:26-alpine AS frontend
WORKDIR /frontend
COPY frontend/package.json frontend/package-lock.json ./
RUN npm ci
COPY frontend/ .
# Same version as the binary (make docker passes it); the UI compares it with /api/version.
ARG VERSION=dev
RUN VITE_APP_VERSION=${VERSION} npm run build
FROM node:26-alpine AS docs
WORKDIR /docs
COPY docs/package.json docs/package-lock.json ./
RUN npm ci
COPY docs/ .
ARG VERSION=dev
RUN VITE_APP_VERSION=${VERSION} npm run build
FROM golang:1.27.2-alpine AS builder
WORKDIR /app
RUN apk --no-cache add ca-certificates tzdata
COPY go.mod go.sum* ./
RUN go mod download
# Build information for the startup log and `solis version` (make docker passes them).
ARG VERSION=dev
ARG COMMIT=unknown
ARG BUILD_DATE=unknown
COPY . .
# The web assets are embedded into the binary (go:embed), so they must exist before go build.
COPY --from=frontend /frontend/dist ./frontend/dist
COPY --from=docs /docs/dist ./docs/dist
RUN CGO_ENABLED=0 go build \
-ldflags="-w -s -X main.Version=${VERSION} -X main.Commit=${COMMIT} -X main.BuildDate=${BUILD_DATE} -X main.GoVersion=$(go env GOVERSION)" \
-a \
-installsuffix cgo \
-o solis ./cmd
FROM scratch
WORKDIR /app
COPY --from=ghcr.io/tarampampam/microcheck:1 /bin/httpcheck /bin/httpcheck
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
COPY --from=builder /usr/share/zoneinfo /usr/share/zoneinfo
COPY --from=builder /app/solis /app
EXPOSE 8080
ENTRYPOINT ["/app/solis"]