new file: serv_golang_rest_api/Dockerfile

modified:   serv_golang_rest_api/docker-compose.yaml
	new file:   serv_golang_rest_api/go.mod
	new file:   serv_golang_rest_api/main.go
build short Golang rest api server in docker compose conteyner
This commit is contained in:
2025-09-25 03:04:53 +05:00
parent e7cb1cb6cc
commit 42638e1638
4 changed files with 47 additions and 31 deletions
+14
View File
@@ -0,0 +1,14 @@
# Build stage
FROM golang:1.25.1 as builder
WORKDIR /app
COPY go.mod go.sum ./
RUN go mod download
COPY *.go ./
RUN CGO_ENABLED=0 GOOS=linux go build -o /go/bin/app
# Final stage
FROM gcr.io/distroless/static-debian12
WORKDIR /
COPY --from=builder /go/bin/app /app
CMD ["/app"]
EXPOSE 8080