Reduce release size
Some checks failed
Build and Push Docker Image to GHCR / build-and-push (push) Failing after 2m42s
Some checks failed
Build and Push Docker Image to GHCR / build-and-push (push) Failing after 2m42s
Switch to all pure go libraries to no longer depends on libc, allowing us to use a static container image. Compress binary using UPX for an addition 7MB
This commit is contained in:
23
Dockerfile
23
Dockerfile
@@ -1,25 +1,28 @@
|
||||
FROM golang:1.25 AS builder
|
||||
|
||||
WORKDIR /app
|
||||
# build dependencies
|
||||
RUN apt update && apt install -y upx
|
||||
|
||||
ENV CGO_ENABLED=1 GOOS=linux GOARCH=amd64
|
||||
RUN apt-get update && apt-get install -y gcc libc6-dev sqlite3 ca-certificates
|
||||
|
||||
COPY go.mod go.sum ./
|
||||
RUN go mod download
|
||||
COPY . .
|
||||
|
||||
# tailwindcss needed for go generate
|
||||
RUN curl -sLO https://github.com/tailwindlabs/tailwindcss/releases/download/v4.1.13/tailwindcss-linux-x64
|
||||
RUN chmod +x tailwindcss-linux-x64
|
||||
RUN mv tailwindcss-linux-x64 /usr/local/bin/tailwindcss
|
||||
|
||||
RUN go install github.com/juls0730/zqdgr@latest
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
ENV CGO_ENABLED=0 GOOS=linux GOARCH=amd64
|
||||
|
||||
COPY go.mod go.sum ./
|
||||
RUN go mod download
|
||||
COPY . .
|
||||
|
||||
|
||||
RUN zqdgr build
|
||||
RUN upx passport
|
||||
|
||||
# ---- Runtime Stage ----
|
||||
FROM gcr.io/distroless/cc-debian12 AS runner
|
||||
FROM gcr.io/distroless/static-debian12 AS runner
|
||||
|
||||
WORKDIR /data
|
||||
COPY --from=builder /app/passport /usr/local/bin/passport
|
||||
|
||||
Reference in New Issue
Block a user