Skip to content

Commit

Permalink
fx dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
SnO2WMaN committed Dec 19, 2023
1 parent 639702e commit a241145
Showing 1 changed file with 19 additions and 8 deletions.
27 changes: 19 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,22 +1,33 @@
# syntax=docker/dockerfile:1
# syntax=docker/dockerfile:1@sha256:ac85f380a63b13dfcefa89046420e1781752bab202122f8f50032edf31be0021

# Builder
FROM golang:1.21.1-alpine AS builder
FROM golang:1.21.1@sha256:19600fdcae402165dcdab18cb9649540bde6be7274dedb5d205b2f84029fe909 AS builder

WORKDIR /app
ENV CGO_ENABLED=0
ENV GOOS=linux
ENV GOARCH=amd64
WORKDIR /build

RUN go install github.com/bufbuild/buf/cmd/buf@latest \
&& go install github.com/fullstorydev/grpcurl/cmd/grpcurl@latest \
&& go install google.golang.org/protobuf/cmd/protoc-gen-go@latest \
&& go install connectrpc.com/connect/cmd/protoc-gen-connect-go@latest
ENV PATH $PATH:/root/.local/bin/:/go/bin/

COPY go.mod go.sum ./
RUN go mod download

COPY *.go ./
RUN CGO_ENABLED=0 go build -o /app -ldflags "-s -w"
COPY . .
RUN buf generate && go build -o main ./cmd/server

# Runner
# hadolint ignore=DL3006
FROM gcr.io/distroless/static-debian11 AS runner
FROM gcr.io/distroless/static-debian11@sha256:9be3fcc6abeaf985b5ecce59451acbcbb15e7be39472320c538d0d55a0834edc AS runner

WORKDIR /app

COPY --from=builder /app /
COPY --from=builder /build/main /

EXPOSE 38080

CMD ["/images"]
CMD ["/main"]

0 comments on commit a241145

Please sign in to comment.