mirror of
https://github.com/Merith-TK/simpleproxy.git
synced 2025-07-03 17:07:05 +01:00
Add OCI Build Script
All checks were successful
Build Docker Image on Commit / build-and-publish (push) Successful in 15s
All checks were successful
Build Docker Image on Commit / build-and-publish (push) Successful in 15s
This commit is contained in:
parent
8f760582e0
commit
61ee070c08
8 changed files with 106 additions and 1 deletions
28
Dockerfile
Normal file
28
Dockerfile
Normal file
|
@ -0,0 +1,28 @@
|
|||
# Build Stage
|
||||
FROM golang:1.22-alpine AS builder
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Install dependencies
|
||||
RUN apk add --no-cache git
|
||||
|
||||
# Copy go modules and download dependencies
|
||||
COPY go.mod go.sum ./
|
||||
RUN go mod download
|
||||
|
||||
# Copy source files
|
||||
COPY ./cmd/simpleproxy ./cmd/simpleproxy
|
||||
|
||||
# Build the binary with optimizations
|
||||
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-s -w" -o /app/simpleproxy ./cmd/simpleproxy
|
||||
|
||||
# Final Minimal Image
|
||||
FROM alpine:latest
|
||||
|
||||
WORKDIR /root/
|
||||
|
||||
# Copy the compiled binary from the builder stage
|
||||
COPY --from=builder /app/simpleproxy .
|
||||
|
||||
# Run the binary
|
||||
ENTRYPOINT ["./simpleproxy"]
|
Loading…
Add table
Add a link
Reference in a new issue