Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitd3b06c0

Browse files
committed
more cacheing
1 parent761601f commitd3b06c0

File tree

2 files changed

+20
-9
lines changed

2 files changed

+20
-9
lines changed

‎.github/workflows/docker-publish.yml

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,6 @@ jobs:
3535
-name:Checkout repository
3636
uses:actions/checkout@v4
3737

38-
-uses:actions/setup-go@v5
39-
with:
40-
go-version-file:./go.mod
41-
check-latest:true
42-
4338
# Install the cosign tool except on PR
4439
# https://github.com/sigstore/cosign-installer
4540
-name:Install cosign
@@ -72,6 +67,17 @@ jobs:
7267
with:
7368
images:${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
7469

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+
7581
# Build and push Docker image with Buildx (don't push on PR)
7682
# https://github.com/docker/build-push-action
7783
-name:Build and push Docker image

‎Dockerfile

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,18 @@ FROM golang:1.23.7 AS build
55
ARG VERSION
66
# Set the working directory
77
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+
1011
# 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 . ./
1216
# 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-buildCGO_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)" \
1418
-o github-mcp-server cmd/github-mcp-server/main.go
19+
1520
# Make a stage to run the app
1621
FROM gcr.io/distroless/base-debian12
1722
# Set the working directory

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp