Skip to content

Commit 49aa01c

Browse files
committed
syz-cluster: refactor Dockerfiles
Copy everything into the build context. Add a .dockerignore file to avoid copying the definitely unnecessary files and folders. Check copyrights presence in Dockerfiles.
1 parent d32f762 commit 49aa01c

File tree

13 files changed

+43
-71
lines changed

13 files changed

+43
-71
lines changed

.dockerignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
.gitignore
2+
bin/
3+
dashboard/
4+
!dashboard/dashapi/
5+
docs/

syz-cluster/controller/Dockerfile

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
1+
# syntax=docker.io/docker/dockerfile:1.7-labs
2+
# Copyright 2025 syzkaller project authors. All rights reserved.
3+
# Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.
14
FROM golang:1.24-alpine AS controller-builder
25

36
WORKDIR /build
47

58
# Prepare the dependencies.
6-
COPY go.mod ./
7-
COPY go.sum ./
9+
COPY go.mod go.sum ./
810
RUN go mod download
9-
COPY pkg/gcs/ pkg/gcs/
10-
COPY pkg/osutil/ pkg/osutil/
1111

1212
# Build the tool.
13-
COPY syz-cluster/controller/ syz-cluster/controller/
14-
COPY syz-cluster/pkg/ syz-cluster/pkg/
13+
COPY --exclude=.git . .
1514
RUN go build -o /bin/controller /build/syz-cluster/controller
1615

1716
# Build the container.

syz-cluster/dashboard/Dockerfile

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,16 @@
1+
# syntax=docker.io/docker/dockerfile:1.7-labs
2+
# Copyright 2025 syzkaller project authors. All rights reserved.
3+
# Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.
14
FROM golang:1.24-alpine AS dashboard-builder
25

36
WORKDIR /build
47

58
# Prepare the dependencies.
6-
COPY go.mod ./
7-
COPY go.sum ./
9+
COPY go.mod go.sum ./
810
RUN go mod download
9-
COPY pkg/gcs/ pkg/gcs/
10-
COPY pkg/osutil/ pkg/osutil/
11-
COPY pkg/html/urlutil/ pkg/html/urlutil/
1211

1312
# Build the tool.
14-
COPY syz-cluster/dashboard/ syz-cluster/dashboard/
15-
COPY syz-cluster/pkg/ syz-cluster/pkg/
13+
COPY --exclude=.git . .
1614
RUN go build -o /bin/web-dashboard /build/syz-cluster/dashboard
1715

1816
# Build the container.

syz-cluster/email-reporter/Dockerfile

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,16 @@
1+
# syntax=docker.io/docker/dockerfile:1.7-labs
2+
# Copyright 2025 syzkaller project authors. All rights reserved.
3+
# Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.
14
FROM golang:1.24-alpine AS email-reporter-builder
25

36
WORKDIR /build
47

58
# Prepare the dependencies.
6-
COPY go.mod ./
7-
COPY go.sum ./
9+
COPY go.mod go.sum ./
810
RUN go mod download
9-
COPY pkg/ pkg/
10-
COPY prog/ prog/
11-
COPY sys/targets/ sys/targets/
12-
COPY dashboard/dashapi/ dashboard/dashapi/
1311

1412
# Build the tool.
15-
COPY syz-cluster/email-reporter/ syz-cluster/email-reporter/
16-
COPY syz-cluster/pkg/ syz-cluster/pkg/
13+
COPY --exclude=.git . .
1714
RUN go build -o /bin/email-reporter /build/syz-cluster/email-reporter
1815

1916
# Build the container.

syz-cluster/reporter-server/Dockerfile

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
1+
# syntax=docker.io/docker/dockerfile:1.7-labs
2+
# Copyright 2025 syzkaller project authors. All rights reserved.
3+
# Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.
14
FROM golang:1.24-alpine AS reporter-builder
25

36
WORKDIR /build
47

58
# Prepare the dependencies.
6-
COPY go.mod ./
7-
COPY go.sum ./
9+
COPY go.mod go.sum ./
810
RUN go mod download
9-
COPY pkg/gcs/ pkg/gcs/
10-
COPY pkg/osutil/ pkg/osutil/
1111

1212
# Build the tool.
13-
COPY syz-cluster/reporter-server/ syz-cluster/reporter-server/
14-
COPY syz-cluster/pkg/ syz-cluster/pkg/
13+
COPY --exclude=.git . .
1514
RUN go build -o /bin/reporter-server /build/syz-cluster/reporter-server
1615

1716
# Build the container.

syz-cluster/series-tracker/Dockerfile

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# syntax=docker.io/docker/dockerfile:1.7-labs
12
# Copyright 2024 syzkaller project authors. All rights reserved.
23
# Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.
34

@@ -10,14 +11,7 @@ COPY go.mod go.sum ./
1011
RUN go mod download
1112

1213
# Build the tool.
13-
COPY pkg/ pkg/
14-
# TODO: get rid of this dependency.
15-
COPY prog/ prog/
16-
COPY dashboard/dashapi/ dashboard/dashapi/
17-
COPY sys/targets/ sys/targets/
18-
COPY syz-cluster/series-tracker/*.go syz-cluster/series-tracker/
19-
COPY syz-cluster/pkg/ syz-cluster/pkg/
20-
14+
COPY --exclude=.git . .
2115
RUN go build -o /build/series-tracker-bin /build/syz-cluster/series-tracker
2216

2317
FROM ubuntu:latest

syz-cluster/tools/db-mgmt/Dockerfile

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
1+
# syntax=docker.io/docker/dockerfile:1.7-labs
2+
# Copyright 2025 syzkaller project authors. All rights reserved.
3+
# Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.
14
FROM golang:1.24-alpine AS builder
25

36
WORKDIR /build
47

58
# Prepare the dependencies.
6-
COPY go.mod ./
7-
COPY go.sum ./
9+
COPY go.mod go.sum ./
810
RUN go mod download
9-
COPY pkg/gcs/ pkg/gcs/
10-
COPY pkg/osutil/ pkg/osutil/
1111

1212
# Build the tool.
13-
COPY syz-cluster/tools/db-mgmt/*.go syz-cluster/tools/db-mgmt/
14-
COPY syz-cluster/pkg/ syz-cluster/pkg/
13+
COPY --exclude=.git . .
1514
RUN go build -o /bin/db-mgmt /build/syz-cluster/tools/db-mgmt
1615

1716
# Create the actual container.

syz-cluster/tools/send-test-email/Dockerfile

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,16 @@
1+
# syntax=docker.io/docker/dockerfile:1.7-labs
2+
# Copyright 2025 syzkaller project authors. All rights reserved.
3+
# Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.
14
FROM golang:1.24-alpine AS builder
25

36
WORKDIR /build
47

58
# Prepare the dependencies.
6-
COPY go.mod ./
7-
COPY go.sum ./
9+
COPY go.mod go.sum ./
810
RUN go mod download
9-
COPY dashboard/dashapi/ dashboard/dashapi/
10-
COPY pkg/gcs/ pkg/gcs/
11-
COPY pkg/email/ pkg/email/
12-
COPY pkg/auth/ pkg/auth/
13-
COPY pkg/gcpsecret/ pkg/gcpsecret/
1411

1512
# Build the tool.
16-
COPY syz-cluster/tools/send-test-email/*.go syz-cluster/tools/send-test-email/
17-
COPY dashboard/dashapi/ dashboard/dashapi/
18-
COPY syz-cluster/pkg/ syz-cluster/pkg/
13+
COPY --exclude=.git . .
1914
RUN go build -o /bin/send-email /build/syz-cluster/tools/send-test-email
2015

2116
# Create the actual container.

syz-cluster/workflow/boot-step/Dockerfile

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,9 @@ WORKDIR /build
1717
# Copy the code and the dependencies.
1818
COPY go.mod go.sum ./
1919
RUN go mod download
20-
COPY pkg/ pkg/
21-
COPY prog/ prog/
22-
COPY vm/ vm/
23-
COPY executor/ executor/
24-
COPY dashboard/dashapi/ dashboard/dashapi/
20+
COPY . .
2521
# Copying from the builder to take the `make descriptions` result.
2622
COPY --from=syzkaller-builder /build/sys/ sys/
27-
COPY syz-cluster/workflow/boot-step/*.go syz-cluster/workflow/boot-step/
28-
COPY syz-cluster/pkg/ syz-cluster/pkg/
2923

3024
RUN go build -o /bin/boot-step /build/syz-cluster/workflow/boot-step
3125

syz-cluster/workflow/build-step/Dockerfile

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,7 @@ FROM gcr.io/syzkaller/env AS build-step-builder
77
WORKDIR /build
88
COPY go.mod go.sum ./
99
RUN go mod download
10-
COPY --exclude=syz-cluster . .
11-
COPY syz-cluster/workflow/build-step/*.go syz-cluster/workflow/build-step/
12-
COPY syz-cluster/pkg/ syz-cluster/pkg/
10+
COPY . .
1311
RUN go build -o /build/build-step-bin /build/syz-cluster/workflow/build-step
1412

1513
# Build on the latest syzbot image.

0 commit comments

Comments
 (0)