Skip to content

Commit

Permalink
start again using docker again
Browse files Browse the repository at this point in the history
  • Loading branch information
AndrewQuijano committed Aug 19, 2024
1 parent 1403ce5 commit 7ea8d7f
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 37 deletions.
6 changes: 3 additions & 3 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
target_injections
target_bins
target_configs
tests
docs
panda
docker
docs
38 changes: 8 additions & 30 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,30 +1,21 @@
ARG NAME=default
ARG BASE_IMAGE="ubuntu:22.04"

### BASE IMAGE
FROM $BASE_IMAGE AS base
ARG BASE_IMAGE
ARG NAME

ENV DEBIAN_FRONTEND=noninteractive
ENV LLVM_DIR=/usr/lib/llvm-11
ENV PATH="/scripts:${PATH}"
ENV PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python
ENV USER=${NAME}

# Copy dependencies lists into container. We copy them all and then do a mv because
# we need to transform base_image into a windows compatible filename which we can't
# do in a COPY command.
COPY ./dependencies/* /tmp
COPY ./requirements.txt /tmp
COPY ./init-host.py /

# Copy the rest of the files
COPY ./target_bins /target_bins
COPY ./target_configs /target_configs
COPY ./scripts /scripts
COPY ./tools/ /tools
RUN mkdir -p /target_injections
COPY ./scripts/ /scripts

RUN mv /tmp/$(echo "$BASE_IMAGE" | sed 's/:/_/g')_build.txt /tmp/build_dep.txt && \
mv /tmp/$(echo "$BASE_IMAGE" | sed 's/:/_/g')_base.txt /tmp/base_dep.txt
Expand All @@ -42,23 +33,13 @@ RUN apt install -qq -y /tmp/pandare_22.04.deb
RUN pip install -r /tmp/requirements.txt

### BUILD IMAGE - STAGE 2
FROM base AS builder
ARG BASE_IMAGE
ARG NAME

RUN [ -e /tmp/build_dep.txt ] && \
apt-get -qq update && \
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends $(cat /tmp/build_dep.txt | grep -o '^[^#]*') && \
apt-get install -y --no-install-recommends $(cat /tmp/build_dep.txt | grep -o '^[^#]*') && \
apt-get clean

RUN python3 init-host.py

#### Develop setup: panda built + pypanda installed (in develop mode) - Stage 3
FROM builder AS developer
ARG BASE_IMAGE
ARG NAME

# Essentially same as setup_container.sh
#### Essentially same as setup_container.sh
RUN cd /tools/btrace && ./compile.sh

RUN rm -rf /tools/build
Expand All @@ -70,12 +51,9 @@ RUN make --no-print-directory -j4 install -C "/tools/build/lavaTool"
RUN make --no-print-directory -j4 install -C "/tools/build/fbi"

# We need 32-bit support inside the container for now
RUN dpkg --add-architecture i386 && apt-get update && DEBIAN_FRONTEND=noninteractive apt-get -y install zlib1g-dev:i386 gcc-multilib
RUN dpkg --add-architecture i386 && apt-get update && apt-get -y install zlib1g-dev:i386 gcc-multilib

#RUN useradd ${NAME}
#RUN chown -R ${NAME}:${NAME} /tools/
#RUN chown -R ${NAME}:${NAME} /scripts/
#RUN chown -R ${NAME}:${NAME} /target_bins/
#RUN chown -R ${NAME}:${NAME} /target_configs/
#RUN chown -R ${NAME}:${NAME} /target_injections/
#USER $NAME
# RUN useradd volcana
# RUN chown -R volcana:volcana /tools/
# RUN chown -R volcana:volcana /scripts/
# USER volcana
6 changes: 2 additions & 4 deletions scripts/bug_mining.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@
curtail = 0

installdir = None
isoname = None
command_args = None

# Replace create_recording in first link
Expand Down Expand Up @@ -141,7 +140,6 @@ def progress(msg):
# e.g. file-5.22-true.iso
installdir = join(sourcedir, 'lava-install')
input_file_guest = join(installdir, input_file_base)
isoname = '{}-{}.iso'.format(sourcedir, input_file_base)
command_args = shlex.split(
project['command'].format(
install_dir=pipes.quote(installdir),
Expand Down Expand Up @@ -179,8 +177,8 @@ def progress(msg):
if not os.path.exists(binpath):
binpath = os.path.join(installdir, proc_name)

pandalog = "{}/queries-{}.plog".format(project['output_dir'], os.path.basename(isoname))
pandalog_json = "{}/queries-{}.json".format(project['output_dir'], os.path.basename(isoname))
pandalog = "{}/queries-{}.plog".format(project['output_dir'], input_file_base)
pandalog_json = "{}/queries-{}.json".format(project['output_dir'], input_file_base)

print("pandalog = [%s] " % pandalog)

Expand Down

0 comments on commit 7ea8d7f

Please sign in to comment.