ejschwartz's picture
pyghidra
977757c
# From https://huggingface.co/spaces/sayakpaul/demo-docker-gradio/blob/main/Dockerfile
FROM blacktop/ghidra:latest
WORKDIR /code
COPY ./uv.lock /code/uv.lock
COPY ./pyproject.toml /code/pyproject.toml
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
--mount=type=cache,target=/var/lib/apt,sharing=locked \
apt-get -y update && apt-get -y install -y python3-pip python3.12-venv git
RUN git clone https://github.com/edmcman/GhidraFunctionCPPExporter /code/GhidraFunctionCPPExporter
RUN --mount=type=cache,target=/root/.cache pip install --break-system-packages --upgrade uv pyghidra
RUN --mount=type=cache,target=/root/.cache uv sync
# Set up a new user named "user"
RUN useradd -m -o -u 1000 user
# Switch to the "user" user
USER user
# Set home to the user's home directory
ENV HOME=/home/user \
PATH=/home/user/.local/bin:$PATH
ENV GHIDRA_INSTALL_DIR=/ghidra
# install pyghidra
RUN yes | /ghidra/support/pyghidraRun -H
# Set the working directory to the user's home directory
WORKDIR $HOME/app
# Copy the current directory contents into the container at $HOME/app setting the owner to the user
COPY --chown=user . $HOME/app
# Disable buffering to allow logging of standard output.
ENV PYTHONUNBUFFERED=1
CMD ["/code/.venv/bin/python", "main.py"]