-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
36 lines (33 loc) · 1.16 KB
/
Dockerfile
File metadata and controls
36 lines (33 loc) · 1.16 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
ARG NODE_VERSION=22
ARG GO_VERSION=1.24
FROM --platform=$BUILDPLATFORM node:${NODE_VERSION}-alpine AS frontend
WORKDIR /app
COPY web/package.json web/package-lock.json ./web/
RUN cd web && npm ci
COPY web ./web
RUN cd web && npm run build
FROM --platform=$BUILDPLATFORM golang:${GO_VERSION}-alpine AS backend
ARG TARGETOS
ARG TARGETARCH
WORKDIR /app
RUN apk add --no-cache git ca-certificates
COPY go.mod go.sum ./
RUN go mod download
COPY cmd ./cmd
COPY internal ./internal
COPY Makefile ./
COPY web/components.json ./web/components.json
COPY web/tailwind.config.cjs web/postcss.config.cjs web/vite.config.ts web/tsconfig*.json ./web/
COPY web/src ./web/src
COPY --from=frontend /app/web/dist ./web/dist
RUN mkdir -p internal/static && rm -rf internal/static/dist && cp -r web/dist internal/static/dist
COPY scripts ./scripts
# RUN go run scripts/generate_pricing.go
RUN CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -o /dashboard ./cmd/dashboard
FROM --platform=$TARGETPLATFORM gcr.io/distroless/base-debian12:nonroot
WORKDIR /app
COPY --from=backend /dashboard /app/dashboard
ENV LISTEN_ADDR=:9090
ENV GRPC_ADDR=:9091
EXPOSE 9090 9091
ENTRYPOINT ["/app/dashboard"]