Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for building in container #80

Open
qrkyckling opened this issue Jul 10, 2021 · 4 comments
Open

Add support for building in container #80

qrkyckling opened this issue Jul 10, 2021 · 4 comments
Labels
enhancement New feature or request

Comments

@qrkyckling
Copy link

I was trying to build this on a few years old Debian machine and discovered the Gradle version was too old.
Rather than reinstall the machine I came up with this one liner to build inside a Docker container and leave the result in same directory.

From the binexport/java directory run:
docker run -it --rm -v $PWD:/home/gradle -v $GHIDRA_INSTALL_DIR:/mnt -e GHIDRA_INSTALL_DIR=/mnt gradle:jdk11

Feel free to mention it in the README.md or add a separate Makefile/build.sh if you think it might help someone.

@cblichmann cblichmann added the enhancement New feature or request label Jul 12, 2021
@cblichmann
Copy link
Member

Neat, thanks!
This is especially useful as I a) didn't know that there are official Gradle Docker containers (kinda obvious in hindsight, duh :-)) and b) we'll have to move to Gradle 7.0+ eventually, which is not in Debian 10.

@qrkyckling
Copy link
Author

No problems :-)

I have not tried. But it should also work in a Win10 / WSL2 environment :-)
Unless the resulting build contain Linux specific items(due to container) the built item should be installable from Ghidra in Windows as well.

Mostly I find it useful because Debian is usually far behind on versions.

@cblichmann
Copy link
Member

I was thinking about something like this Dockerfile:

# Use Gradle Ubuntu 22.04.4 LTS with OpenJDK17 as a base
FROM gradle:8.7-jdk17-jammy

ENV TZ=Europe/Zurich\
    DEBIAN_FRONTEND=noninteractive\
    GHIDRA_INSTALL_DIR=/opt/ghidra

RUN \
    apt-get update && \
    apt-get install -qy --no-install-recommends \
        gnupg \
    && \
    # Clean up to save space
    apt-get clean && \
    rm -rf /var/lib/apt/lists/* && \
    # Install Ghidra
    [ "$(wget -qO - \
            https://github.com/NationalSecurityAgency/ghidra/releases/download/Ghidra_11.0.3_build/ghidra_11.0.3_PUBLIC_20240410.zip | \
            tee ghidra.zip | sha256sum | cut '-d ' -f1)" = \
        "2462a2d0ab11e30f9e907cd3b4aa6b48dd2642f325617e3d922c28e752be6761" ] && \
    unzip -q -d /opt ghidra.zip && \
    mv /opt/ghidra_*_PUBLIC /opt/ghidra && \
    rm ghidra.zip

Enhancement ideas:

  • Allow to specify Ghidra version in ARG
  • Install jq and query GitHub for the specified release in ARG or use latest

@cblichmann
Copy link
Member

d45f445 added release artifacts via GitHub Actions (see #127).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants