From 10c27bf3791fa48a68213acc4ea61e2f464869fa Mon Sep 17 00:00:00 2001 From: jackmisbach Date: Sat, 29 Nov 2025 06:56:55 -0600 Subject: [PATCH] Optimize and cleanup Dockerfile (#3442) * Optimize and cleanup Dockerfile * Add .git/ to .dockerignore --- .dockerignore | 3 +++ Dockerfile | 20 +++++++++----------- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/.dockerignore b/.dockerignore index 8c490aa7e..8c21dfa49 100644 --- a/.dockerignore +++ b/.dockerignore @@ -14,3 +14,6 @@ tests/binaries/**/div_zero_binary/binary # ignore QEMU test images (could also be tainted) tests/library/qemu_system/kimages + +# ignore .git directory +.git/ \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index c00615bfd..da7d5097a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -22,19 +22,17 @@ ENV UV_PROJECT_ENVIRONMENT=/venv RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && \ echo $TZ > /etc/timezone && \ apt-get update && \ - apt-get install -y locales && \ - rm -rf /var/lib/apt/lists/* && \ + apt-get install -y --no-install-recommends \ + locales vim && \ localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8 && \ - apt-get update && \ - apt-get install -y vim + apt-get clean && rm -rf /var/lib/apt/lists/* # setup.sh needs scripts/common.sh -RUN mkdir scripts -ADD ./scripts/common.sh /pwndbg/scripts/ +COPY ./scripts/common.sh /pwndbg/scripts/ -ADD ./setup.sh /pwndbg/ -ADD ./uv.lock /pwndbg/ -ADD ./pyproject.toml /pwndbg/ +COPY ./setup.sh /pwndbg/ +COPY ./uv.lock /pwndbg/ +COPY ./pyproject.toml /pwndbg/ # pyproject.toml requires these files, pip install would fail RUN touch README.md && mkdir pwndbg && touch pwndbg/empty.py @@ -42,7 +40,7 @@ RUN touch README.md && mkdir pwndbg && touch pwndbg/empty.py RUN DEBIAN_FRONTEND=noninteractive ./setup.sh # Comment these lines if you won't run the tests. -ADD ./setup-dev.sh /pwndbg/ +COPY ./setup-dev.sh /pwndbg/ RUN ./setup-dev.sh # Cleanup dummy files @@ -50,7 +48,7 @@ RUN rm README.md && rm -rf pwndbg FROM base AS full -ADD . /pwndbg/ +COPY . /pwndbg/ ARG LOW_PRIVILEGE_USER="vscode"