Skip to content

Commit

Permalink
ci(Dockerfile): add Go SDK to resulting image
Browse files Browse the repository at this point in the history
  • Loading branch information
tdakkota committed Dec 3, 2024
1 parent 35d970b commit 9b7af49
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,19 +1,16 @@
ARG GO_VERSION=latest

FROM golang:$GO_VERSION as builder

FROM golang:$GO_VERSION AS builder
WORKDIR /go/src/app

COPY . .

RUN go mod download

RUN CGO_ENABLED=0 go build -o /go/bin/ogen ./cmd/ogen/main.go

FROM scratch

# We need go in resulting image to run goimports.
COPY --from=builder /usr/local/go/ /usr/local/go/
ENV PATH="/usr/local/go/bin:${PATH}"
# Copy built binary.
WORKDIR /

COPY --from=builder /go/bin/ogen ./ogen

ENTRYPOINT ["./ogen"]

0 comments on commit 9b7af49

Please sign in to comment.