Skip to content

Commit

Permalink
doc: use lang-specific base-builder images (#6415)
Browse files Browse the repository at this point in the history
  • Loading branch information
catenacyber committed Sep 8, 2021
1 parent e39ef9c commit 0e3ee07
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 0 deletions.
2 changes: 2 additions & 0 deletions docs/getting-started/new-project-guide/go_lang.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ sanitizers:

### Dockerfile

The Dockerfile should start by `FROM gcr.io/oss-fuzz-base/base-builder-go`

The OSS-Fuzz builder image has the latest stable release of Golang installed. In
order to install dependencies of your project, add `RUN git clone ...` command to
your Dockerfile.
Expand Down
2 changes: 2 additions & 0 deletions docs/getting-started/new-project-guide/jvm_lang.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ sanitizers:

### Dockerfile

The Dockerfile should start by `FROM gcr.io/oss-fuzz-base/base-builder-jvm`

The OSS-Fuzz base Docker images already come with OpenJDK 15 pre-installed. If
you need Maven to build your project, you can install it by adding the following
line to your Dockerfile:
Expand Down
2 changes: 2 additions & 0 deletions docs/getting-started/new-project-guide/python_lang.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ sanitizers:

### Dockerfile

The Dockerfile should start by `FROM gcr.io/oss-fuzz-base/base-builder-python`

Because most dependencies are already pre-installed on the images, no
significant changes are needed in the Dockerfile for Python fuzzing projects.
You should simply clone the project, set a `WORKDIR`, and copy any necessary
Expand Down
2 changes: 2 additions & 0 deletions docs/getting-started/new-project-guide/rust_lang.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ fuzzing_engines:

### Dockerfile

The Dockerfile should start by `FROM gcr.io/oss-fuzz-base/base-builder-rust`

The OSS-Fuzz builder image has the latest nightly release of Rust as well as
`cargo fuzz` pre-installed and in `PATH`. In the `Dockerfile` for your project
all you'll need to do is fetch the latest copy of your code and install any
Expand Down
11 changes: 11 additions & 0 deletions docs/getting-started/new_project_guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ Programming language the project is written in. Values you can specify include:
* [`rust`]({{ site.baseurl }}//getting-started/new-project-guide/rust-lang/)
* [`python`]({{ site.baseurl }}//getting-started/new-project-guide/python-lang/)
* [`jvm` (Java, Kotlin, Scala and other JVM-based languages)]({{ site.baseurl }}//getting-started/new-project-guide/jvm-lang/)
* [`swift`]({{ site.baseurl }}//getting-started/new-project-guide/swift/)

### primary_contact, auto_ccs {#primary}
The primary contact and list of other contacts to be CCed. Each person listed gets access to ClusterFuzz, including crash reports and fuzzer statistics, and are auto-cced on new bugs filed in the OSS-Fuzz
Expand Down Expand Up @@ -208,11 +209,21 @@ COPY build.sh fuzzer.cc $SRC/ # copy build script and other fuzze
```
In the above example, the git clone will check out the source to `$SRC/<checkout_dir>`.

Depending on your project's language, you will use a different base image,
for instance `FROM gcr.io/oss-fuzz-base/base-builder-go` for golang.

For an example, see
[expat/Dockerfile](https://github.com/google/oss-fuzz/tree/master/projects/expat/Dockerfile)
or
[syzkaller/Dockerfile](https://github.com/google/oss-fuzz/blob/master/projects/syzkaller/Dockerfile).

In the case of a project with multiple languages/toolchains needed,
you can run installation scripts `install_lang.sh` where lang is the language needed.
You also need to setup environment variables needed by this toolchain, for example `GOPATH` is needed by golang.
For an example, see
[ecc-diff-fuzzer/Dockerfile](https://github.com/google/oss-fuzz/blob/master/projects/ecc-diff-fuzzer/Dockerfile).
where we use `base-builder-rust`and install golang

## build.sh {#buildsh}

This file defines how to build binaries for [fuzz targets]({{ site.baseurl }}/reference/glossary/#fuzz-target) in your project.
Expand Down

0 comments on commit 0e3ee07

Please sign in to comment.