-
-
Notifications
You must be signed in to change notification settings - Fork 601
Expand file tree
/
Copy pathDockerfile
More file actions
83 lines (58 loc) · 2.03 KB
/
Copy pathDockerfile
File metadata and controls
83 lines (58 loc) · 2.03 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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# Build assets
FROM --platform=$BUILDPLATFORM node:25.9.0-alpine AS node
RUN npm install -g --force corepack && corepack enable
ENV CI=true
WORKDIR /build
# Install dependencies from lock file
COPY pnpm-lock.yaml pnpm-workspace.yaml ./
RUN pnpm fetch --ignore-scripts
# Copy package.json and install dependencies
COPY package.json ./
RUN pnpm install --offline --ignore-scripts
# Copy assets and translations to build
COPY vite.config.ts tsconfig.json .prettierrc.cjs .npmrc ./
COPY assets ./assets
COPY locales ./locales
COPY public ./public
ARG CLOUD_URL
ENV CLOUD_URL=$CLOUD_URL
# Build assets
RUN pnpm build
FROM --platform=$BUILDPLATFORM golang:1.27-alpine AS builder
RUN apk add --no-cache ca-certificates && mkdir /dozzle
WORKDIR /dozzle
# Copy go mod files
COPY go.* ./
RUN --mount=type=cache,target=/go/pkg/mod go mod download
# Copy all other files
COPY internal ./internal
COPY proto ./proto
COPY types ./types
COPY main.go ./
COPY protos ./protos
COPY shared_key.pem shared_cert.pem ./
# Copy assets built with node
COPY --from=node /build/dist ./dist
# Args
ARG TAG=dev
ARG TARGETOS TARGETARCH
# Build binary
RUN --mount=type=cache,target=/go/pkg/mod --mount=type=cache,target=/root/.cache/go-build \
GOOS=$TARGETOS GOARCH=$TARGETARCH CGO_ENABLED=0 go build -ldflags "-s -w -X github.com/amir20/dozzle/internal/support/cli.Version=$TAG" -o dozzle
RUN mkdir /data
# Optional variant published as :alpine for platforms that bind-mount a shell
# wrapper over the entrypoint. Must stay above the scratch stage so that the
# last stage remains the default build target.
FROM alpine:3.24 AS alpine
COPY --from=builder /data /data
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
COPY --from=builder /dozzle/dozzle /dozzle
EXPOSE 8080
ENTRYPOINT ["/dozzle"]
FROM scratch
COPY --from=builder /data /data
COPY --from=builder /tmp /tmp
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
COPY --from=builder /dozzle/dozzle /dozzle
EXPOSE 8080
ENTRYPOINT ["/dozzle"]