dev: public ready
dev: Readme, COC, others dev: xml-template
This commit is contained in:
parent
5db584830b
commit
1cf5119f46
12 changed files with 3716 additions and 0 deletions
32
Containerfile
Normal file
32
Containerfile
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
# Build stage
|
||||
FROM golang:bookworm AS builder
|
||||
|
||||
# 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
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY go.mod ./
|
||||
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
|
||||
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