Initial commit with basic example
This commit is contained in:
26
proxy/Dockerfile
Normal file
26
proxy/Dockerfile
Normal file
@ -0,0 +1,26 @@
|
||||
# Stage 1: Build the Go binary
|
||||
FROM golang:1.24.2-alpine AS builder
|
||||
|
||||
# Set working directory inside the build container
|
||||
WORKDIR /app
|
||||
|
||||
# Copy Go module files and source code
|
||||
COPY go.mod ./
|
||||
RUN go mod download
|
||||
|
||||
COPY . .
|
||||
|
||||
# Build the Go binary statically
|
||||
RUN CGO_ENABLED=0 GOOS=linux go build -o docker-api-proxy .
|
||||
|
||||
# Stage 2: Run binary in minimal container
|
||||
FROM scratch
|
||||
|
||||
# Copy binary from builder
|
||||
COPY --from=builder /app/docker-api-proxy /usr/local/bin/docker-api-proxy
|
||||
|
||||
# Run binary
|
||||
ENTRYPOINT ["docker-api-proxy"]
|
||||
|
||||
# Default port
|
||||
EXPOSE 80
|
Reference in New Issue
Block a user