-
Notifications
You must be signed in to change notification settings - Fork 322
Expand file tree
/
Copy pathDockerfile
More file actions
55 lines (40 loc) · 1.49 KB
/
Dockerfile
File metadata and controls
55 lines (40 loc) · 1.49 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
49
50
51
52
53
54
55
ARG GOLANG_VERSION=1.25.4
ARG ALPINE_VERSION=3.22
FROM golang:${GOLANG_VERSION}-alpine${ALPINE_VERSION} AS builder
RUN apk add --no-cache make
# Cached golang dependencies
WORKDIR /build/shared
COPY ./shared/go.mod ./shared/go.sum ./
RUN go mod download
WORKDIR /build/clickhouse
COPY ./clickhouse/go.mod ./clickhouse/go.sum ./
RUN go mod download
WORKDIR /build/db
COPY ./db/go.mod ./db/go.sum ./
RUN go mod download
WORKDIR /build/auth
COPY ./auth/go.mod ./auth/go.sum ./
RUN go mod download
WORKDIR /build/dashboard-api
COPY ./dashboard-api/go.mod ./dashboard-api/go.sum ./
RUN go mod download
# Copy source code
WORKDIR /build
COPY ./auth/pkg ./auth/pkg
COPY ./clickhouse/pkg ./clickhouse/pkg
COPY ./shared/pkg ./shared/pkg
COPY ./db/client ./db/client
COPY ./db/queries ./db/queries
COPY ./db/pkg ./db/pkg
COPY ./dashboard-api/internal ./dashboard-api/internal
COPY ./dashboard-api/main.go ./dashboard-api/main.go
COPY ./dashboard-api/Makefile ./dashboard-api/Makefile
WORKDIR /build/dashboard-api
ARG COMMIT_SHA
ARG EXPECTED_CORE_MIGRATION_TIMESTAMP
ARG EXPECTED_DASHBOARD_MIGRATION_TIMESTAMP
RUN --mount=type=cache,target=/root/.cache/go-build make build COMMIT_SHA=${COMMIT_SHA} EXPECTED_CORE_MIGRATION_TIMESTAMP=${EXPECTED_CORE_MIGRATION_TIMESTAMP} EXPECTED_DASHBOARD_MIGRATION_TIMESTAMP=${EXPECTED_DASHBOARD_MIGRATION_TIMESTAMP}
RUN chmod +x /build/dashboard-api/bin/dashboard-api
FROM alpine:${ALPINE_VERSION}
COPY --from=builder /build/dashboard-api/bin/dashboard-api .
ENTRYPOINT ["./dashboard-api"]