Skip to content

Commit 43b1e17

Browse files
author
XavierTrump
committed
fix(ci): 修复 Hub Docker 构建上下文
1 parent c5af41f commit 43b1e17

2 files changed

Lines changed: 12 additions & 11 deletions

File tree

.github/workflows/checks.yml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -193,14 +193,11 @@ jobs:
193193
docker:
194194
name: Docker build (Hub Server)
195195
runs-on: ubuntu-latest
196-
defaults:
197-
run:
198-
working-directory: hub-server
199196
steps:
200197
- uses: actions/checkout@v4
201198

202199
- name: Build Docker image
203-
run: docker build -t agenthub-hub-server -f deployments/Dockerfile .
200+
run: docker build -t agenthub-hub-server -f hub-server/deployments/Dockerfile .
204201

205202
- name: Verify image
206203
run: docker images agenthub-hub-server

hub-server/deployments/Dockerfile

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,22 @@
11
FROM golang:1.25-alpine AS builder
22
WORKDIR /app
3-
COPY go.mod go.sum ./
4-
RUN go mod download
5-
COPY . .
6-
RUN CGO_ENABLED=0 go build -ldflags="-s -w" -o server-hub ./cmd/server-hub
3+
COPY go.work ./
4+
COPY pkg/go.mod ./pkg/go.mod
5+
COPY edge-server/go.mod edge-server/go.sum ./edge-server/
6+
COPY hub-server/go.mod hub-server/go.sum ./hub-server/
7+
RUN cd hub-server && go mod download
8+
COPY pkg ./pkg
9+
COPY hub-server ./hub-server
10+
RUN cd hub-server && CGO_ENABLED=0 go build -ldflags="-s -w" -o server-hub ./cmd/server-hub
711

812
FROM alpine:3.21
913
RUN apk upgrade --no-cache && apk add --no-cache ca-certificates tzdata wget
1014
RUN echo "hosts: files dns" > /etc/nsswitch.conf
1115
RUN adduser -D -h /app agenthub
1216
WORKDIR /app
13-
COPY --from=builder /app/server-hub .
14-
COPY --from=builder /app/configs/config.docker.yaml ./configs/config.yaml
15-
COPY --from=builder /app/migrations ./migrations
17+
COPY --from=builder /app/hub-server/server-hub .
18+
COPY --from=builder /app/hub-server/configs/config.docker.yaml ./configs/config.yaml
19+
COPY --from=builder /app/hub-server/migrations ./migrations
1620
RUN chown -R agenthub:agenthub /app
1721
USER agenthub
1822
EXPOSE 8080

0 commit comments

Comments
 (0)