diff --git a/docker/Dockerfile b/docker/Dockerfile index ae1c6d33..ce5623bf 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,35 +1,53 @@ -FROM ubuntu:rolling -LABEL maintainer "pschmied " +FROM alpine:edge AS builder +LABEL maintainer "Philipp Schmied " # Prevent build fails because of interactive scripts when compiling ENV DEBIAN_FRONTEND noninteractive # Dependencies -RUN apt-get update && \ - apt-get -y install \ - cmake \ - curl \ - g++ \ - gcc \ - git-core \ - gosu \ - libqt5svg5-dev \ - make \ - pkg-config \ - python3 \ - python3-dev \ - qt5-default \ - qtbase5-dev \ - qtwebengine5-dev \ - unzip \ - wget +RUN apk add --no-cache \ + bash \ + cmake \ + curl \ + g++ \ + gcc \ + git \ + linux-headers \ + make \ + pkgconfig \ + python3-dev \ + qt5-qtbase \ + qt5-qtsvg-dev \ + qt5-qttools-dev \ + unzip \ + wget # Get, compile and test Cutter from master branch -RUN git clone --recurse-submodules https://github.com/radareorg/cutter.git /opt/cutter && \ - cd /opt/cutter && \ +RUN git clone --recurse-submodules https://github.com/radareorg/cutter.git /opt/cutter +RUN cd /opt/cutter && \ bash build.sh && \ bash -c 'if [[ ! -x "/opt/cutter/build/Cutter" ]]; then exit -1; fi' +FROM alpine:edge AS runner + +# Add the dependencies we need for running +RUN apk add --no-cache \ + bash \ + libuuid \ + make \ + python3 \ + qt5-qtbase \ + shadow \ + su-exec + +# Get the compiled Cutter, r2 libs and bins from the builder +COPY --from=builder /opt/cutter /opt/cutter +COPY --from=builder /usr/lib /usr/lib +COPY --from=builder /usr/share/radare2 /usr/share/radare2 +RUN cd /opt/cutter/radare2/binr && \ + make install && \ + make symstall install-symlink + # Add r2 user RUN useradd r2 @@ -42,4 +60,5 @@ RUN mkdir /var/sharedFolder && \ WORKDIR /home/r2 ADD entrypoint.sh /usr/local/bin/entrypoint.sh + ENTRYPOINT ["/usr/local/bin/entrypoint.sh"] diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh index 0b4a2e43..5e961260 100755 --- a/docker/entrypoint.sh +++ b/docker/entrypoint.sh @@ -6,4 +6,4 @@ usermod -u $LOCAL_USER_ID $USERNAME usermod -g $LOCAL_GROUP_ID $USERNAME export HOME=/home/$USERNAME -exec gosu $USERNAME "/opt/cutter/build/Cutter" $@ +exec su-exec $USERNAME "/opt/cutter/build/Cutter" $@