-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update go version and otel to graphql apis
- Loading branch information
Showing
10 changed files
with
327 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,40 @@ | ||
FROM golang:1.17.6-alpine | ||
|
||
MAINTAINER Zaid Albirawi | ||
|
||
WORKDIR /go/src/github.com/zalbiraw/go-api-test-service | ||
|
||
COPY go.mod go.mod | ||
COPY helpers/ helpers/ | ||
COPY services/ services/ | ||
|
||
RUN go mod tidy | ||
RUN go mod vendor | ||
RUN CGO_ENABLED=0 GO111MODULE=on go build -o services/rest/rest services/rest/rest/server.go | ||
RUN CGO_ENABLED=0 GO111MODULE=on go build -o services/rest/users services/rest/users/server.go | ||
RUN CGO_ENABLED=0 GO111MODULE=on go build -o services/rest/posts services/rest/posts/server.go | ||
RUN CGO_ENABLED=0 GO111MODULE=on go build -o services/rest/comments services/rest/comments/server.go | ||
RUN CGO_ENABLED=0 GO111MODULE=on go build -o services/graphql/users services/graphql/users/server.go | ||
RUN CGO_ENABLED=0 GO111MODULE=on go build -o services/graphql/posts services/graphql/posts/server.go | ||
RUN CGO_ENABLED=0 GO111MODULE=on go build -o services/graphql/comments services/graphql/comments/server.go | ||
RUN CGO_ENABLED=0 GO111MODULE=on go build -o services/graphql/notifications services/graphql/notifications/server.go | ||
RUN CGO_ENABLED=0 GO111MODULE=on go build -o services/graphql-subgraphs/users services/graphql-subgraphs/users/server.go | ||
RUN CGO_ENABLED=0 GO111MODULE=on go build -o services/graphql-subgraphs/posts services/graphql-subgraphs/posts/server.go | ||
RUN CGO_ENABLED=0 GO111MODULE=on go build -o services/graphql-subgraphs/comments services/graphql-subgraphs/comments/server.go | ||
RUN CGO_ENABLED=0 GO111MODULE=on go build -o services/graphql-subgraphs/notifications services/graphql-subgraphs/notifications/server.go | ||
# Stage 1: Build all Go binaries | ||
FROM golang:1.23-alpine AS builder | ||
|
||
LABEL maintainer="Zaid Albirawi" | ||
|
||
# Set the working directory inside the container | ||
WORKDIR /go/src/github.com/zalbiraw/go-api-test-service | ||
|
||
# Copy the go.mod and go.sum files for dependency caching | ||
COPY go.mod go.sum ./ | ||
|
||
# Download dependencies | ||
RUN go mod download | ||
|
||
# Copy the rest of the source code | ||
COPY helpers/ helpers/ | ||
COPY services/ services/ | ||
|
||
# Build all the Go binaries | ||
RUN CGO_ENABLED=0 GO111MODULE=on go build -o /go/bin/rest-rest services/rest/rest/server.go | ||
RUN CGO_ENABLED=0 GO111MODULE=on go build -o /go/bin/rest-users services/rest/users/server.go | ||
RUN CGO_ENABLED=0 GO111MODULE=on go build -o /go/bin/rest-posts services/rest/posts/server.go | ||
RUN CGO_ENABLED=0 GO111MODULE=on go build -o /go/bin/rest-comments services/rest/comments/server.go | ||
RUN CGO_ENABLED=0 GO111MODULE=on go build -o /go/bin/graphql-users services/graphql/users/server.go | ||
RUN CGO_ENABLED=0 GO111MODULE=on go build -o /go/bin/graphql-posts services/graphql/posts/server.go | ||
RUN CGO_ENABLED=0 GO111MODULE=on go build -o /go/bin/graphql-comments services/graphql/comments/server.go | ||
RUN CGO_ENABLED=0 GO111MODULE=on go build -o /go/bin/graphql-notifications services/graphql/notifications/server.go | ||
RUN CGO_ENABLED=0 GO111MODULE=on go build -o /go/bin/graphql-subgraphs-users services/graphql-subgraphs/users/server.go | ||
RUN CGO_ENABLED=0 GO111MODULE=on go build -o /go/bin/graphql-subgraphs-posts services/graphql-subgraphs/posts/server.go | ||
RUN CGO_ENABLED=0 GO111MODULE=on go build -o /go/bin/graphql-subgraphs-comments services/graphql-subgraphs/comments/server.go | ||
RUN CGO_ENABLED=0 GO111MODULE=on go build -o /go/bin/graphql-subgraphs-notifications services/graphql-subgraphs/notifications/server.go | ||
|
||
# Stage 2: Create the final lightweight image | ||
FROM alpine:latest | ||
|
||
# Set the working directory | ||
WORKDIR /root/ | ||
|
||
# Copy all the built binaries from the builder stage | ||
COPY --from=builder /go/bin/* /usr/local/bin/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.