Skip to content

Commit

Permalink
[infra] Prevent mounting local checkout to $SRC + clean up Dockerfiles (
Browse files Browse the repository at this point in the history
  • Loading branch information
Dor1s authored Aug 9, 2018
1 parent a8521a4 commit 8d3e462
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
10 changes: 5 additions & 5 deletions infra/helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -295,9 +295,10 @@ def _env_to_docker_args(env_list):
return sum([['-e', v] for v in env_list], [])


def _workdir_from_dockerfile(dockerfile_path):
"""Parse WORKDIR from the Dockerfile."""
WORKDIR_REGEX = re.compile(r'\s*WORKDIR\s*([^\s]+)')
def _workdir_from_dockerfile(project_name):
"""Parse WORKDIR from the Dockerfile for the given project."""
WORKDIR_REGEX = re.compile(r'\s*WORKDIR\s*(\$SRC/[^\s]+)')
dockerfile_path = _get_dockerfile_path(project_name)

with open(dockerfile_path) as f:
lines = f.readlines()
Expand Down Expand Up @@ -435,8 +436,7 @@ def build_fuzzers(args):
command += [
'-v',
'%s:%s' % (_get_absolute_path(args.source_path),
_workdir_from_dockerfile(
_get_dockerfile_path(args.project_name))),
_workdir_from_dockerfile(args.project_name)),
]
command += [
'-v', '%s:/out' % project_out_dir,
Expand Down
4 changes: 2 additions & 2 deletions projects/curl/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ RUN git clone --depth 1 https://github.com/curl/curl.git /src/curl
RUN git clone --depth 1 https://github.com/curl/curl-fuzzer.git /src/curl_fuzzer

# Use curl-fuzzer's scripts to get latest dependencies.
RUN /src/curl_fuzzer/scripts/ossfuzzdeps.sh
RUN $SRC/curl_fuzzer/scripts/ossfuzzdeps.sh

WORKDIR /src/curl_fuzzer
WORKDIR $SRC/curl_fuzzer
COPY build.sh $SRC/
2 changes: 1 addition & 1 deletion projects/envoy/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,5 @@ RUN curl https://bazel.build/bazel-release.pub.gpg | apt-key add -
RUN apt-get update && apt-get install -y bazel

RUN git clone https://github.com/envoyproxy/envoy.git
WORKDIR /src/envoy/
WORKDIR $SRC/envoy/
COPY find_corpus.py build.sh $SRC/
2 changes: 1 addition & 1 deletion projects/grpc/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,5 @@ RUN chmod +x ./bazel-0.10.0-installer-linux-x86_64.sh
RUN ./bazel-0.10.0-installer-linux-x86_64.sh

RUN git clone --recursive https://github.com/grpc/grpc grpc
WORKDIR /src/grpc/
WORKDIR $SRC/grpc/
COPY build.sh $SRC/

0 comments on commit 8d3e462

Please sign in to comment.