File size: 1,284 Bytes
fd9a510
66f8fc1
fd9a510
66f8fc1
 
 
f2c9f68
1a488de
66f8fc1
fd9a510
 
84c34da
1684317
 
66f8fc1
84c34da
91509bc
 
fd9a510
 
 
56069ce
 
 
 
 
 
 
 
abb881c
9ab25dc
977757c
 
 
56069ce
 
 
 
 
66f8fc1
9ab25dc
 
 
505c045
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# 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"]