File tree Expand file tree Collapse file tree 2 files changed +20
-9
lines changed Expand file tree Collapse file tree 2 files changed +20
-9
lines changed Original file line number Diff line number Diff line change 35
35
- name : Checkout repository
36
36
uses : actions/checkout@v4
37
37
38
- - uses : actions/setup-go@v5
39
- with :
40
- go-version-file : ./go.mod
41
- check-latest : true
42
-
43
38
# Install the cosign tool except on PR
44
39
# https://github.com/sigstore/cosign-installer
45
40
- name : Install cosign
72
67
with :
73
68
images : ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
74
69
70
+ - name : Go Build Cache for Docker
71
+ uses : actions/cache@v4
72
+ with :
73
+ path : go-build-cache
74
+ key : ${{ runner.os }}-go-build-cache-${{ hashFiles('**/go.sum') }}
75
+
76
+ - name : Inject go-build-cache
77
+ uses : reproducible-containers/buildkit-cache-dance@4b2444fec0c0fb9dbf175a96c094720a692ef810 # v2.1.4
78
+ with :
79
+ cache-source : go-build-cache
80
+
75
81
# Build and push Docker image with Buildx (don't push on PR)
76
82
# https://github.com/docker/build-push-action
77
83
- name : Build and push Docker image
Original file line number Diff line number Diff line change @@ -5,13 +5,18 @@ FROM golang:1.23.7 AS build
5
5
ARG VERSION
6
6
# Set the working directory
7
7
WORKDIR /build
8
- # Copy the current directory contents into the working directory
9
- COPY . .
8
+
9
+ RUN go env -w GOMODCACHE=/root/.cache/go-build
10
+
10
11
# Install dependencies
11
- RUN go mod download
12
+ COPY go.mod go.sum ./
13
+ RUN --mount=type=cache,target=/root/.cache/go-build go mod download
14
+
15
+ COPY . ./
12
16
# Build the server
13
- RUN CGO_ENABLED=0 go build -ldflags="-s -w -X main.version=${VERSION} -X main.commit=$(git rev-parse HEAD) -X main.date=$(date -u +%Y-%m-%dT%H:%M:%SZ)" \
17
+ RUN --mount=type=cache,target=/root/.cache/go-build CGO_ENABLED=0 go build -ldflags="-s -w -X main.version=${VERSION} -X main.commit=$(git rev-parse HEAD) -X main.date=$(date -u +%Y-%m-%dT%H:%M:%SZ)" \
14
18
-o github-mcp-server cmd/github-mcp-server/main.go
19
+
15
20
# Make a stage to run the app
16
21
FROM gcr.io/distroless/base-debian12
17
22
# Set the working directory
You can’t perform that action at this time.
0 commit comments