-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.release
More file actions
45 lines (30 loc) · 983 Bytes
/
Dockerfile.release
File metadata and controls
45 lines (30 loc) · 983 Bytes
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
FROM oven/bun:1 AS frontend
WORKDIR /app
COPY dashboard/package.json dashboard/bun.lockb* ./dashboard/
RUN cd dashboard && bun install --frozen-lockfile
COPY dashboard/ ./dashboard/
RUN cd dashboard && bun run build
FROM golang:1.24-alpine AS builder
RUN apk add --no-cache upx git
WORKDIR /app
COPY go.mod go.sum ./
RUN go mod download
COPY --from=frontend /app/dashboard/dist ./dashboard/dist
COPY . .
ARG GIT_TAG
ARG GIT_COMMIT
ARG BUILD_TIME
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo \
-ldflags "-w -s \
-X github.com/cheetahbyte/flagly/internal/version.Version=${GIT_TAG} \
-X github.com/cheetahbyte/flagly/internal/version.Commit=${GIT_COMMIT} \
-X github.com/cheetahbyte/flagly/internal/version.BuildTime=${BUILD_TIME}" \
-o main .
RUN upx --best --lzma -o main-compressed main
FROM scratch
WORKDIR /root/
COPY --from=builder /app/main-compressed ./flagly
EXPOSE 8080
ENV PORT=8080
ENV GIN_MODE=release
ENTRYPOINT ["./flagly"]