From c4b68b0c1bb37fcdb02fbb3d1f0adab6bd684dd9 Mon Sep 17 00:00:00 2001 From: Robert Steiner Date: Fri, 1 Dec 2023 16:37:40 +0100 Subject: [PATCH] Fix devcontainer (#2675) --- .devcontainer/Dockerfile | 4 ++-- .devcontainer/devcontainer.json | 16 ++++++++++------ ...r-how-to-develop-in-vscode-dev-containers.rst | 4 ++-- 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 016c12af2426..61c8d14039db 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -24,8 +24,8 @@ RUN SNIPPET="export PROMPT_COMMAND='history -a' && export HISTFILE=/commandhisto && echo $SNIPPET >> "/home/$USERNAME/.bashrc" # Install system dependencies -RUN apt update -RUN apt install -y curl wget gnupg python3 python-is-python3 python3-pip git \ +RUN apt-get update +RUN apt-get install -y curl wget gnupg python3 python-is-python3 python3-pip git \ build-essential tmux vim RUN python -m pip install \ diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index a4a2d37c2cb1..8ba9269ed8a4 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,11 +1,15 @@ { "dockerFile": "Dockerfile", - "postCreateCommand": "poetry install --extras \"simulation\"", - "extensions": ["ms-python.python"], - "settings": { - "files.watcherExclude": {}, - "search.exclude": {}, - "terminal.integrated.defaultProfile.linux": "bash" + "postCreateCommand": "sudo poetry install --extras \"simulation\"", + "customizations": { + "vscode": { + "settings": { + "files.watcherExclude": { }, + "search.exclude": { }, + "terminal.integrated.defaultProfile.linux": "bash" + }, + "extensions": [ "ms-python.python" ] + } }, "remoteUser": "flwr-vscode", "containerEnv": { diff --git a/doc/source/contributor-how-to-develop-in-vscode-dev-containers.rst b/doc/source/contributor-how-to-develop-in-vscode-dev-containers.rst index 3782196b4c7b..d9a4cf6b7c82 100644 --- a/doc/source/contributor-how-to-develop-in-vscode-dev-containers.rst +++ b/doc/source/contributor-how-to-develop-in-vscode-dev-containers.rst @@ -1,4 +1,4 @@ -Develop in VSCode Dev Containers +Develop in VSCode Dev Containers ================================ When working on the Flower framework we want to ensure that all contributors use the same developer environment to format code or run tests. For this purpose we are using the VSCode Remote Containers extension. What is it? Read the following quote: @@ -14,7 +14,7 @@ Source: `Official VSCode documentation `_. +Configuring and setting up the :code:`Dockerfile` as well the configuration for the devcontainer can be a bit more involved. The good thing is you don't have to do it. Usually it should be enough to install [Docker](https://docs.docker.com/engine/install/) on your system and ensure its available on your command line. Additionally, install the `VSCode Containers Extension `_. Now you should be good to go. When starting VSCode, it will ask you to run in the container environment and - if you confirm - automatically build the container and use it. To manually instruct VSCode to use the devcontainer, you can, after installing the extension, click the green area in the bottom left corner of your VSCode window and select the option *(Re)Open Folder in Container*.