From b8111a5ff05c2d03f5d4b4ddc0b3993f00b9422c Mon Sep 17 00:00:00 2001 From: yhna Date: Sat, 12 Oct 2024 20:42:20 +0900 Subject: [PATCH 1/5] Fix cpu docker file for dev env --- docker/accelerate-cpu/Dockerfile | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/docker/accelerate-cpu/Dockerfile b/docker/accelerate-cpu/Dockerfile index ac417634215..f5962fa5b20 100644 --- a/docker/accelerate-cpu/Dockerfile +++ b/docker/accelerate-cpu/Dockerfile @@ -27,8 +27,12 @@ RUN python3 -m pip install --no-cache-dir \ # Stage 2 FROM python:3.8-slim AS build-image COPY --from=compile-image /opt/venv /opt/venv -RUN useradd -ms /bin/bash user -USER user + +# Install make +RUN apt-get update && \ + apt-get install -y make && \ + apt-get clean && \ + rm -rf /var/lib/apt/lists* # Make sure we use the virtualenv ENV PATH="/opt/venv/bin:$PATH" From e5794d2781fd653f3a5cfafa7be05179af0d0206 Mon Sep 17 00:00:00 2001 From: yhna Date: Sat, 12 Oct 2024 20:54:36 +0900 Subject: [PATCH 2/5] Mv make install cmd --- .devcontainer/devcontainer.json | 2 +- docker/accelerate-cpu/Dockerfile | 6 ------ 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 7a0da240489..28a26880c76 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -25,5 +25,5 @@ }, "workspaceFolder": "/workspaces/accelerate", // Need git for VSCode to color code modifications. Only runs when building environment. - "onCreateCommand": "apt-get update && apt-get install -y git && pip install -e '.[dev]'" + "onCreateCommand": "apt-get update && apt-get install -y git make && pip install -e '.[dev]'" } \ No newline at end of file diff --git a/docker/accelerate-cpu/Dockerfile b/docker/accelerate-cpu/Dockerfile index f5962fa5b20..0b6d3502df9 100644 --- a/docker/accelerate-cpu/Dockerfile +++ b/docker/accelerate-cpu/Dockerfile @@ -28,12 +28,6 @@ RUN python3 -m pip install --no-cache-dir \ FROM python:3.8-slim AS build-image COPY --from=compile-image /opt/venv /opt/venv -# Install make -RUN apt-get update && \ - apt-get install -y make && \ - apt-get clean && \ - rm -rf /var/lib/apt/lists* - # Make sure we use the virtualenv ENV PATH="/opt/venv/bin:$PATH" CMD ["/bin/bash"] \ No newline at end of file From 9ea2d8762cdbfb911d5110125fc0f39f290d816b Mon Sep 17 00:00:00 2001 From: yhna940 Date: Thu, 31 Oct 2024 23:35:25 +0900 Subject: [PATCH 3/5] Grant specific permissions for the non root user --- = | 3 +++ docker/accelerate-cpu/Dockerfile | 5 ++++- 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 = diff --git a/= b/= new file mode 100644 index 00000000000..b37aadbeadb --- /dev/null +++ b/= @@ -0,0 +1,3 @@ +Collecting hf-doc-builder + Obtaining dependency information for hf-doc-builder from https://files.pythonhosted.org/packages/40/89/b794a9f2708f2926d3050132541952bc44eeeb1e560dc34fd00bace47655/hf_doc_builder-0.5.0-py3-none-any.whl.metadata + Downloading hf_doc_builder-0.5.0-py3-none-any.whl.metadata (28 kB) diff --git a/docker/accelerate-cpu/Dockerfile b/docker/accelerate-cpu/Dockerfile index 1317afae992..7f249b8a376 100644 --- a/docker/accelerate-cpu/Dockerfile +++ b/docker/accelerate-cpu/Dockerfile @@ -1,7 +1,7 @@ # Builds CPU-only Docker image of PyTorch # Uses multi-staged approach to reduce size # Stage 1 -FROM python:3.9-slim as compile-image +FROM python:3.8-slim as compile-image ARG DEBIAN_FRONTEND=noninteractive @@ -27,6 +27,9 @@ RUN python3 -m pip install --no-cache-dir \ # Stage 2 FROM python:3.9-slim AS build-image COPY --from=compile-image /opt/venv /opt/venv +RUN useradd -ms /bin/bash user +RUN echo "user ALL=(ALL) NOPASSWD: /usr/bin/apt-get, /usr/bin/pip" >> /etc/sudoers +USER user # Make sure we use the virtualenv ENV PATH="/opt/venv/bin:$PATH" From e736ad222ed2a0fd29083fec920fd0eb48af8e14 Mon Sep 17 00:00:00 2001 From: yhna940 Date: Thu, 31 Oct 2024 23:36:39 +0900 Subject: [PATCH 4/5] Fix py version --- docker/accelerate-cpu/Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docker/accelerate-cpu/Dockerfile b/docker/accelerate-cpu/Dockerfile index 7f249b8a376..98aeff6994e 100644 --- a/docker/accelerate-cpu/Dockerfile +++ b/docker/accelerate-cpu/Dockerfile @@ -1,7 +1,7 @@ # Builds CPU-only Docker image of PyTorch # Uses multi-staged approach to reduce size # Stage 1 -FROM python:3.8-slim as compile-image +FROM python:3.9-slim as compile-image ARG DEBIAN_FRONTEND=noninteractive @@ -33,4 +33,4 @@ USER user # Make sure we use the virtualenv ENV PATH="/opt/venv/bin:$PATH" -CMD ["/bin/bash"] \ No newline at end of file +CMD ["/bin/bash"] From bff157af1e896bebc33d49f660878dd0234c1c89 Mon Sep 17 00:00:00 2001 From: yhna940 Date: Thu, 31 Oct 2024 23:49:01 +0900 Subject: [PATCH 5/5] Del unused file --- = | 3 --- 1 file changed, 3 deletions(-) delete mode 100644 = diff --git a/= b/= deleted file mode 100644 index b37aadbeadb..00000000000 --- a/= +++ /dev/null @@ -1,3 +0,0 @@ -Collecting hf-doc-builder - Obtaining dependency information for hf-doc-builder from https://files.pythonhosted.org/packages/40/89/b794a9f2708f2926d3050132541952bc44eeeb1e560dc34fd00bace47655/hf_doc_builder-0.5.0-py3-none-any.whl.metadata - Downloading hf_doc_builder-0.5.0-py3-none-any.whl.metadata (28 kB)