-
Notifications
You must be signed in to change notification settings - Fork 59
Expand file tree
/
Copy pathDockerfile
More file actions
31 lines (20 loc) · 828 Bytes
/
Dockerfile
File metadata and controls
31 lines (20 loc) · 828 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
FROM --platform=$BUILDPLATFORM golang:1.24.0-bookworm as builder
ARG BUILDPLATFORM
ARG TARGETPLATFORM
ARG TARGETOS
ARG TARGETARCH
WORKDIR /app
RUN apt-get update && apt-get install -y gcc-aarch64-linux-gnu gcc
RUN go install github.com/evanw/esbuild/cmd/esbuild@latest
COPY go.mod go.sum ./
RUN go mod download && go mod verify
COPY . .
RUN esbuild index.js --bundle --minify --format=esm --outfile=assets/bundle.js --loader:.js=jsx --jsx-factory=h --jsx-fragment=Fragment
RUN CGO_ENABLED=1 CC=$([ "$TARGETARCH" = "arm64" ] && echo "aarch64-linux-gnu-gcc" || echo "gcc") GOOS=$TARGETOS GOARCH=$TARGETARCH go build --tags "fts5" -v -o ./zen .
FROM --platform=$TARGETPLATFORM debian:bookworm-slim
COPY --from=builder /app/zen /zen
VOLUME /data
VOLUME /images
ENV DATA_FOLDER=/data
ENV IMAGES_FOLDER=/images
CMD ["/zen"]