Fixes:
- AVIF fixed - Removed code - Severe changes were needed
This commit is contained in:
parent
bab3b6c8f7
commit
c2dd83327b
7 changed files with 1081 additions and 617 deletions
|
|
@ -1,32 +1,40 @@
|
|||
# Build stage
|
||||
FROM golang:bookworm AS builder
|
||||
FROM golang:alpine AS builder
|
||||
RUN apk add --no-cache \
|
||||
musl-dev \
|
||||
gcc \
|
||||
wget \
|
||||
xz \
|
||||
git
|
||||
|
||||
# Install UPX
|
||||
RUN apt-get update && apt-get install -y wget xz-utils && rm -rf /var/lib/apt/lists/*
|
||||
|
||||
RUN wget https://github.com/upx/upx/releases/download/v5.0.2/upx-5.0.2-amd64_linux.tar.xz
|
||||
RUN tar -xf upx-5.0.2-amd64_linux.tar.xz && mv upx-5.0.2-amd64_linux/upx /usr/local/bin/upx && rm -r upx-5.0.2-amd64_linux upx-5.0.2-amd64_linux.tar.xz
|
||||
RUN wget https://github.com/upx/upx/releases/download/v5.0.2/upx-5.0.2-amd64_linux.tar.xz && \
|
||||
tar -xf upx-5.0.2-amd64_linux.tar.xz && \
|
||||
mv upx-5.0.2-amd64_linux/upx /usr/local/bin/upx && \
|
||||
rm -r upx-5.0.2-amd64_linux upx-5.0.2-amd64_linux.tar.xz
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY go.mod ./
|
||||
COPY go.mod go.sum ./
|
||||
|
||||
RUN go mod download
|
||||
|
||||
COPY . .
|
||||
|
||||
RUN mkdir -p /var/sockets
|
||||
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -ldflags="-s -w -extldflags '-static' -X main.GOMEMLIMIT=256MiB -X runtime.defaultGOGC=50" -trimpath -gcflags="-l=4" -asmflags=-trimpath -o bin/main app/gopherbook/main.go
|
||||
# Build with CGO and increased WASM memory limits
|
||||
RUN CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build \
|
||||
-a \
|
||||
-ldflags="-s -w -linkmode external -extldflags '-static' -X main.GOMEMLIMIT=512MiB -X runtime.defaultGOGC=50" \
|
||||
-trimpath \
|
||||
-o bin/main app/gopherbook/main.go
|
||||
RUN upx --best --ultra-brute bin/main
|
||||
RUN chmod +x bin/main
|
||||
|
||||
# Final stage with Chainguard static
|
||||
FROM cgr.dev/chainguard/static:latest
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Copy the binary
|
||||
COPY --from=builder /app/bin/main ./bin/main
|
||||
|
||||
# Create directories that will be mounted and set ownership
|
||||
EXPOSE 8080
|
||||
USER root:root
|
||||
CMD ["./bin/main"]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue