From 5711cec1b36b98e7ea9ec1778ae82bc959fa00dc Mon Sep 17 00:00:00 2001 From: ll7 <32880741+ll7@users.noreply.github.com> Date: Wed, 22 May 2024 13:19:15 +0200 Subject: [PATCH 01/27] chore: Add Dockerfile for development environment setup First try with only starting a pygame window in windows from a docker container --- .devcontainer/Dockerfile | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 .devcontainer/Dockerfile diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 0000000..9df173b --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,23 @@ +# Use the official Python base image +FROM python:3.9 + +# Install necessary dependencies +RUN apt-get update && \ + apt-get install -y python3-pip python3-dev \ + python3-opengl libsdl2-dev libsdl2-image-dev libsdl2-mixer-dev libsdl2-ttf-dev \ + libsmpeg-dev libportmidi-dev libavformat-dev libswscale-dev libjpeg-dev libfreetype6-dev + +# Install Pygame +RUN pip install pygame + +# Set the display environment variable +ENV DISPLAY=host.docker.internal:0.0 + +# Copy the Pygame script into the container +COPY pygame_script.py /usr/src/app/ + +# Set the working directory +WORKDIR /usr/src/app + +# Run the Pygame script +CMD ["python", "pygame_script.py"] From a62e03bcbe7ebfe349078bdb337122b9808ca05e Mon Sep 17 00:00:00 2001 From: ll7 <32880741+ll7@users.noreply.github.com> Date: Wed, 22 May 2024 13:20:05 +0200 Subject: [PATCH 02/27] chore: Add pygame script for basic window setup only for testing purposes to check if a pygame window gets launched on windows --- .devcontainer/pygame_script.py | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 .devcontainer/pygame_script.py diff --git a/.devcontainer/pygame_script.py b/.devcontainer/pygame_script.py new file mode 100644 index 0000000..bc5e5b9 --- /dev/null +++ b/.devcontainer/pygame_script.py @@ -0,0 +1,26 @@ +import pygame +import sys + +# Initialize Pygame +pygame.init() + +# Set up the display +screen = pygame.display.set_mode((640, 480)) +pygame.display.set_caption('Pygame Window') + +# Main game loop +running = True +while running: + for event in pygame.event.get(): + if event.type == pygame.QUIT: + running = False + + # Fill the screen with a color + screen.fill((0, 128, 255)) + + # Update the display + pygame.display.flip() + +# Quit Pygame +pygame.quit() +sys.exit() From 3c182f37238322e4bffbb1f68803b484cb007b77 Mon Sep 17 00:00:00 2001 From: ll7 <32880741+ll7@users.noreply.github.com> Date: Wed, 22 May 2024 13:20:30 +0200 Subject: [PATCH 03/27] chore: Add .devcontainer configuration file for development environment setup first example --- .devcontainer/devcontainer.json | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 .devcontainer/devcontainer.json diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000..46bf45c --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,10 @@ +{ + "name": "robot-sf-ll7-devcontainer", + "dockerFile": "Dockerfile", + "runArgs": [ + "--network=host", + "-e", "DISPLAY=host.docker.internal:0.0" + ], + + +} \ No newline at end of file From 7ef6d2217d7fc085941bd441b48f0f065f1005ff Mon Sep 17 00:00:00 2001 From: ll7 <32880741+ll7@users.noreply.github.com> Date: Wed, 22 May 2024 13:23:04 +0200 Subject: [PATCH 04/27] chore: Update Dockerfile and .devcontainer configuration for Pygame window setup on Windows 11 mainly to remember all notes --- .devcontainer/readme.md | 109 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 109 insertions(+) create mode 100644 .devcontainer/readme.md diff --git a/.devcontainer/readme.md b/.devcontainer/readme.md new file mode 100644 index 0000000..2cb280a --- /dev/null +++ b/.devcontainer/readme.md @@ -0,0 +1,109 @@ +# Devcontainer + +Creating a Docker image that can create a Pygame window on Windows 11 involves several steps. Pygame is a popular set of Python modules designed for writing video games. It requires access to graphical libraries which can be a bit tricky to set up in Docker because Docker containers are typically run in headless environments (without a graphical interface). However, it can be done with the help of X server. + +Here are the steps to create a Docker image for running a Pygame window on Windows 11: + +1. **Install Docker**: Ensure that Docker is installed on your Windows 11 machine. You can download and install Docker Desktop from the official Docker website. + +2. **Create Dockerfile**: Create a `Dockerfile` to specify the environment and dependencies. + +3. **Configure X Server**: On Windows, you will need an X server to display the Pygame window. Xming or VcXsrv are common choices for Windows. Install and configure an X server to allow connections from your Docker container. + +4. **Run Docker Container**: Start the Docker container and ensure it can connect to the X server on your Windows host. + +Here is a step-by-step guide: + +### Step 1: Install X Server on Windows + +1. **Download and Install VcXsrv**: + - Download VcXsrv from [sourceforge.net](https://sourceforge.net/projects/vcxsrv/). + - Install VcXsrv using the default settings. + - Run VcXsrv, selecting the "Multiple windows" option, and ensure the "Disable access control" option is checked. + +### Step 2: Create the Dockerfile + +Create a directory for your Docker setup and create a file named `Dockerfile` with the following content: + +```Dockerfile +# Use the official Python base image +FROM python:3.9 + +# Install necessary dependencies +RUN apt-get update && \ + apt-get install -y python3-pip python3-dev \ + python3-opengl libsdl2-dev libsdl2-image-dev libsdl2-mixer-dev libsdl2-ttf-dev \ + libsmpeg-dev libportmidi-dev libavformat-dev libswscale-dev libjpeg-dev libfreetype6-dev + +# Install Pygame +RUN pip install pygame + +# Set the display environment variable +ENV DISPLAY=host.docker.internal:0.0 + +# Copy the Pygame script into the container +COPY pygame_script.py /usr/src/app/ + +# Set the working directory +WORKDIR /usr/src/app + +# Run the Pygame script +CMD ["python", "pygame_script.py"] +``` + +### Step 3: Create a Pygame Script + +In the same directory, create a simple Pygame script named `pygame_script.py`: + +```python +import pygame +import sys + +# Initialize Pygame +pygame.init() + +# Set up the display +screen = pygame.display.set_mode((640, 480)) +pygame.display.set_caption('Pygame Window') + +# Main game loop +running = True +while running: + for event in pygame.event.get(): + if event.type == pygame.QUIT: + running = False + + # Fill the screen with a color + screen.fill((0, 128, 255)) + + # Update the display + pygame.display.flip() + +# Quit Pygame +pygame.quit() +sys.exit() +``` + +### Step 4: Build and Run the Docker Container + +1. **Build the Docker Image**: + Open a terminal in the directory containing your `Dockerfile` and `pygame_script.py` and run: + + ```sh + docker build -t pygame-app . + ``` + +2. **Run the Docker Container**: + Ensure your X server (VcXsrv) is running on Windows, then run the Docker container: + + ```sh + docker run --rm -e DISPLAY=host.docker.internal:0.0 pygame-app + ``` + +This command sets the `DISPLAY` environment variable to use the X server running on your Windows host. The `--rm` flag ensures the container is removed after it stops. + +You should see the Pygame window appear on your Windows desktop, managed by the X server. + +### Summary + +By following these steps, you should be able to create a Docker image that can display a Pygame window on Windows 11 using an X server like VcXsrv. This setup allows you to leverage Docker's isolation and portability while still being able to run graphical applications. \ No newline at end of file From 0293e7273b42ad1c85c22efe7e0ceeb777494685 Mon Sep 17 00:00:00 2001 From: ll7 <32880741+ll7@users.noreply.github.com> Date: Wed, 22 May 2024 13:23:11 +0200 Subject: [PATCH 05/27] chore: Update Dockerfile and .devcontainer configuration for Pygame window setup on Windows 11 --- .devcontainer/devcontainer.md | 108 ++++++++++++++++++++++++++++++++++ 1 file changed, 108 insertions(+) create mode 100644 .devcontainer/devcontainer.md diff --git a/.devcontainer/devcontainer.md b/.devcontainer/devcontainer.md new file mode 100644 index 0000000..a74606f --- /dev/null +++ b/.devcontainer/devcontainer.md @@ -0,0 +1,108 @@ +To achieve the same setup using `devcontainer.json` for a development container in Visual Studio Code, you'll need to set up a development container with the necessary configuration. The `devcontainer.json` file defines the configuration for the development container. + +Here's how you can do it: + +### Step 1: Install Required Extensions + +Make sure you have the following extensions installed in Visual Studio Code: +- **Remote - Containers**: Allows you to open any folder or repository inside a container and take advantage of Visual Studio Code's full feature set. + +### Step 2: Create the Development Container Configuration + +1. **Create a `.devcontainer` folder** in your project directory. +2. **Create a `devcontainer.json` file** inside the `.devcontainer` folder with the following content: + + ```json + { + "name": "Pygame Dev Container", + "image": "mcr.microsoft.com/vscode/devcontainers/python:3.9", + "runArgs": [ + "--network=host", + "-e", "DISPLAY=host.docker.internal:0.0" + ], + "postCreateCommand": "pip install pygame", + "customizations": { + "vscode": { + "extensions": [ + "ms-python.python" + ] + } + }, + "remoteUser": "vscode" + } + ``` + +### Step 3: Create the Dockerfile + +In the same `.devcontainer` folder, create a `Dockerfile` with the following content: + +```Dockerfile +# Use the official Python base image +FROM mcr.microsoft.com/vscode/devcontainers/python:3.9 + +# Install necessary dependencies +RUN apt-get update && \ + apt-get install -y python3-opengl libsdl2-dev libsdl2-image-dev libsdl2-mixer-dev libsdl2-ttf-dev \ + libsmpeg-dev libportmidi-dev libavformat-dev libswscale-dev libjpeg-dev libfreetype6-dev + +# Set the display environment variable +ENV DISPLAY=host.docker.internal:0.0 + +# Install Pygame +RUN pip install pygame +``` + +### Step 4: Create the Pygame Script + +In the root of your project directory, create the Pygame script named `pygame_script.py`: + +```python +import pygame +import sys + +# Initialize Pygame +pygame.init() + +# Set up the display +screen = pygame.display.set_mode((640, 480)) +pygame.display.set_caption('Pygame Window') + +# Main game loop +running = True +while running: + for event in pygame.event.get(): + if event.type == pygame.QUIT: + running = False + + # Fill the screen with a color + screen.fill((0, 128, 255)) + + # Update the display + pygame.display.flip() + +# Quit Pygame +pygame.quit() +sys.exit() +``` + +### Step 5: Open the Project in a Development Container + +1. **Open your project folder** in Visual Studio Code. +2. **Open the Command Palette** (F1) and select `Remote-Containers: Reopen in Container`. + +Visual Studio Code will build the container based on the `Dockerfile` and `devcontainer.json` configuration. It will then open the project inside the development container. + +### Step 6: Run the Pygame Script + +1. **Open a terminal** in Visual Studio Code (inside the container). +2. **Run the Pygame script**: + + ```sh + python pygame_script.py + ``` + +The Pygame window should appear on your Windows desktop, managed by the X server (VcXsrv). + +### Summary + +By following these steps, you can create a development container for running a Pygame window on Windows 11 using Visual Studio Code and a `devcontainer.json` configuration. This setup leverages the benefits of development containers, such as isolation and portability, while still allowing you to run graphical applications. \ No newline at end of file From 7ce1e4e703b006e14a1c37f5949e8fbd06b5cb3e Mon Sep 17 00:00:00 2001 From: ll7 <32880741+ll7@users.noreply.github.com> Date: Wed, 29 May 2024 09:14:00 +0000 Subject: [PATCH 06/27] chore: Set git to auto adjust for the correct line endings between different operating systems --- .devcontainer/Dockerfile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 9df173b..c06ef1e 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -1,6 +1,9 @@ # Use the official Python base image FROM python:3.9 +# Set git to auto adjust for the correct line endings between different operating systems +RUN git config --global core.autocrlf true + # Install necessary dependencies RUN apt-get update && \ apt-get install -y python3-pip python3-dev \ From fa0f6a90fea6de642a87418ead06c28f38761bce Mon Sep 17 00:00:00 2001 From: ll7 <32880741+ll7@users.noreply.github.com> Date: Wed, 29 May 2024 09:14:20 +0000 Subject: [PATCH 07/27] chore: Update Dockerfile and .devcontainer configuration for Pygame window setup on Windows 11 --- .devcontainer/Dockerfile | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index c06ef1e..345e96c 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -1,9 +1,6 @@ # Use the official Python base image FROM python:3.9 -# Set git to auto adjust for the correct line endings between different operating systems -RUN git config --global core.autocrlf true - # Install necessary dependencies RUN apt-get update && \ apt-get install -y python3-pip python3-dev \ @@ -24,3 +21,5 @@ WORKDIR /usr/src/app # Run the Pygame script CMD ["python", "pygame_script.py"] + +RUN pip install --upgrade pip \ No newline at end of file From 1c7ccb7aec665a0dcb4b1a7526ba7a2833aaee80 Mon Sep 17 00:00:00 2001 From: ll7 <32880741+ll7@users.noreply.github.com> Date: Wed, 29 May 2024 09:14:50 +0000 Subject: [PATCH 08/27] chore: remove test specific dockerfile commands --- .devcontainer/Dockerfile | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 345e96c..4018cd2 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -1,6 +1,9 @@ # Use the official Python base image FROM python:3.9 +# Set git to auto adjust for the correct line endings between different operating systems +RUN git config --global core.autocrlf true + # Install necessary dependencies RUN apt-get update && \ apt-get install -y python3-pip python3-dev \ @@ -13,13 +16,11 @@ RUN pip install pygame # Set the display environment variable ENV DISPLAY=host.docker.internal:0.0 -# Copy the Pygame script into the container -COPY pygame_script.py /usr/src/app/ - -# Set the working directory -WORKDIR /usr/src/app +# # Copy the Pygame script into the container +# COPY pygame_script.py /usr/src/app/ -# Run the Pygame script -CMD ["python", "pygame_script.py"] +# # Set the working directory +# WORKDIR /usr/src/app -RUN pip install --upgrade pip \ No newline at end of file +# # Run the Pygame script +# CMD ["python", "pygame_script.py"] From 867b94995a542fa048e3b2a7b14d2df5885fc2ac Mon Sep 17 00:00:00 2001 From: ll7 <32880741+ll7@users.noreply.github.com> Date: Wed, 29 May 2024 09:15:06 +0000 Subject: [PATCH 09/27] chore: Upgrade pip to the latest version --- .devcontainer/Dockerfile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 4018cd2..8c73163 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -24,3 +24,5 @@ ENV DISPLAY=host.docker.internal:0.0 # # Run the Pygame script # CMD ["python", "pygame_script.py"] + +RUN pip install --upgrade pip \ No newline at end of file From 1827d6a041982d845dd5db13bb0dcef0cc75cbe6 Mon Sep 17 00:00:00 2001 From: ll7 <32880741+ll7@users.noreply.github.com> Date: Wed, 29 May 2024 09:15:25 +0000 Subject: [PATCH 10/27] chore: Update .devcontainer configuration --- .devcontainer/devcontainer.json | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 46bf45c..c210cfe 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,10 +1,17 @@ { "name": "robot-sf-ll7-devcontainer", - "dockerFile": "Dockerfile", + "build": { + "dockerfile": "Dockerfile", + "context": "..", + "args": { + "VARIANT": "sf-ll7" + } + , "runArgs": [ "--network=host", "-e", "DISPLAY=host.docker.internal:0.0" ], - - + "settings": { + "terminal.integrated.shell.linux": "/bin/bash" + }, } \ No newline at end of file From 7ae205a894e5900920c377b389b683a4b2ce0332 Mon Sep 17 00:00:00 2001 From: ll7 Date: Wed, 29 May 2024 09:26:52 +0000 Subject: [PATCH 11/27] chore: Install project dependencies and packages in devcontainer This commit updates the devcontainer.json file to include post-create commands for installing project dependencies and packages. The commands include installing the requirements.txt file, the requirements.txt file in the fast-pysf directory, and the project itself. This ensures that the development environment is properly set up with all the necessary dependencies. --- .devcontainer/devcontainer.json | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index c210cfe..1656b91 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -14,4 +14,11 @@ "settings": { "terminal.integrated.shell.linux": "/bin/bash" }, + "postCreateCommand": [ + "pip install -r requirements.txt", + "pip install -r fast-pysf/requirements.txt", + "pip install -e .", + "pip install -e fast-pysf" + ] +}, } \ No newline at end of file From 2d3b0e11511e8cae2287bc91809620a507de56f0 Mon Sep 17 00:00:00 2001 From: ll7 Date: Wed, 29 May 2024 09:27:17 +0000 Subject: [PATCH 12/27] chore: Update devcontainer.json with additional VS Code extensions This commit adds the following VS Code extensions to the devcontainer.json file: - ms-python.python - ms-vscode-remote.remote-containers - GitHub.vscode-pull-request-github - GitHub.copilot - mhutchie.git-graph - ms-python.pylint - genieai.chatgpt-vscode These extensions enhance the development experience by providing additional functionality and tools within the VS Code editor. --- .devcontainer/devcontainer.json | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 1656b91..85b627b 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -21,4 +21,16 @@ "pip install -e fast-pysf" ] }, +"customizations": { + "vscode": { + "extensions": [ + "ms-python.python", + "ms-vscode-remote.remote-containers", + "GitHub.vscode-pull-request-github", + "GitHub.copilot", + "mhutchie.git-graph", + "ms-python.pylint", + "genieai.chatgpt-vscode" + ] + } } \ No newline at end of file From cc1255dce52fa7a7d4324e5caebe6a6f76d8d28f Mon Sep 17 00:00:00 2001 From: ll7 Date: Wed, 29 May 2024 09:27:43 +0000 Subject: [PATCH 13/27] chore: Update requirements.txt to not use local installation of robot_sf and pysf --- requirements.txt | 2 -- 1 file changed, 2 deletions(-) diff --git a/requirements.txt b/requirements.txt index 0cba59d..b518016 100644 --- a/requirements.txt +++ b/requirements.txt @@ -67,14 +67,12 @@ Pygments==2.17.2 pylint==3.0.3 pynvml==11.4.1 pyparsing==3.1.1 --e git+https://github.com/ll7/pysocialforce-ll7@1b3caf09ffe37784ef894f0530f715a39caea66e#egg=PySocialForce&subdirectory=../../fast-pysf pytest==8.0.1 python-dateutil==2.8.2 pytz==2024.1 PyYAML==6.0.1 requests==2.31.0 rich==13.7.0 --e git+https://github.com/ll7/robot_sf_ll7@0d1e3d5537929d500ace5fa6badd4757731c54cf#egg=robot_sf scalene==1.5.34 scipy==1.12.0 sentry-sdk==1.40.6 From f942654979a240d73b92c88a9eb909bd23035e9c Mon Sep 17 00:00:00 2001 From: ll7 Date: Wed, 29 May 2024 09:27:53 +0000 Subject: [PATCH 14/27] Update pip in devcontainer Dockerfile --- .devcontainer/Dockerfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 8c73163..ee54d27 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -25,4 +25,5 @@ ENV DISPLAY=host.docker.internal:0.0 # # Run the Pygame script # CMD ["python", "pygame_script.py"] -RUN pip install --upgrade pip \ No newline at end of file +# Update pip +RUN pip install --upgrade pip From 349362549f18cc5c975e05a05c208ae27f8d0750 Mon Sep 17 00:00:00 2001 From: ll7 Date: Wed, 29 May 2024 09:28:56 +0000 Subject: [PATCH 15/27] chore: Remove Pygame installation from devcontainer Dockerfile --- .devcontainer/Dockerfile | 3 --- 1 file changed, 3 deletions(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index ee54d27..a321c85 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -10,9 +10,6 @@ RUN apt-get update && \ python3-opengl libsdl2-dev libsdl2-image-dev libsdl2-mixer-dev libsdl2-ttf-dev \ libsmpeg-dev libportmidi-dev libavformat-dev libswscale-dev libjpeg-dev libfreetype6-dev -# Install Pygame -RUN pip install pygame - # Set the display environment variable ENV DISPLAY=host.docker.internal:0.0 From 1185b5941ebfaf5a2e7c1c345e507dad0a59b8b0 Mon Sep 17 00:00:00 2001 From: ll7 Date: Wed, 29 May 2024 09:29:28 +0000 Subject: [PATCH 16/27] remove unused comments --- .devcontainer/Dockerfile | 9 --------- 1 file changed, 9 deletions(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index a321c85..1b7c0d5 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -13,14 +13,5 @@ RUN apt-get update && \ # Set the display environment variable ENV DISPLAY=host.docker.internal:0.0 -# # Copy the Pygame script into the container -# COPY pygame_script.py /usr/src/app/ - -# # Set the working directory -# WORKDIR /usr/src/app - -# # Run the Pygame script -# CMD ["python", "pygame_script.py"] - # Update pip RUN pip install --upgrade pip From eb7f42de6b66258680c1521ab62822bae4583a38 Mon Sep 17 00:00:00 2001 From: ll7 Date: Wed, 29 May 2024 09:43:25 +0000 Subject: [PATCH 17/27] chore: Add loguru==0.7.2 to requirements.txt --- requirements.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/requirements.txt b/requirements.txt index b518016..4728a03 100644 --- a/requirements.txt +++ b/requirements.txt @@ -97,3 +97,4 @@ tzdata==2024.1 urllib3==2.2.1 wandb==0.16.4 Werkzeug==3.0.1 +loguru==0.7.2 From b092c9bcce71b903ac8c933a9c8bf1bd5c793880 Mon Sep 17 00:00:00 2001 From: ll7 Date: Wed, 29 May 2024 09:43:48 +0000 Subject: [PATCH 18/27] chore: Update devcontainer.json with git submodule update command This commit adds the "git submodule update --init --recursive" command to the postCreateCommand section of the devcontainer.json file. This command ensures that the git submodules are properly initialized and updated when creating the development container. This is necessary for the project to function correctly. --- .devcontainer/devcontainer.json | 1 + 1 file changed, 1 insertion(+) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 85b627b..809c11a 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -15,6 +15,7 @@ "terminal.integrated.shell.linux": "/bin/bash" }, "postCreateCommand": [ + "git submodule update --init --recursive", "pip install -r requirements.txt", "pip install -r fast-pysf/requirements.txt", "pip install -e .", From 09dec15f4df90df77af74f789d6aefb17e497af5 Mon Sep 17 00:00:00 2001 From: ll7 Date: Wed, 29 May 2024 09:44:00 +0000 Subject: [PATCH 19/27] chore: Update devcontainer Dockerfile to use nvidia/cuda base image This commit updates the devcontainer Dockerfile to use the nvidia/cuda:12.4.1-base-ubuntu22.04 base image instead of the python:3.9 image. This change is made to support GPU acceleration in the development environment. --- .devcontainer/Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 1b7c0d5..46da38e 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -1,12 +1,12 @@ # Use the official Python base image -FROM python:3.9 +FROM nvidia/cuda:12.4.1-base-ubuntu22.04 # Set git to auto adjust for the correct line endings between different operating systems RUN git config --global core.autocrlf true # Install necessary dependencies RUN apt-get update && \ - apt-get install -y python3-pip python3-dev \ + apt-get install -y python3 python3-pip python3-dev \ python3-opengl libsdl2-dev libsdl2-image-dev libsdl2-mixer-dev libsdl2-ttf-dev \ libsmpeg-dev libportmidi-dev libavformat-dev libswscale-dev libjpeg-dev libfreetype6-dev From 2183a9bc65e03e5bdabe3ed8865926be7118e466 Mon Sep 17 00:00:00 2001 From: ll7 Date: Wed, 29 May 2024 11:33:10 +0000 Subject: [PATCH 20/27] chore: Update postCreate.sh script to install project dependencies This commit updates the postCreate.sh script to include commands for installing project dependencies. The script now runs "pip install -r requirements.txt" to install the main project dependencies, "pip install -r fast-pysf/requirements.txt" to install the dependencies for the fast-pysf submodule, and "pip install -e ." and "pip install -e fast-pysf" to install the project itself and the fast-pysf submodule in editable mode. This ensures that the development environment is properly set up with all the necessary dependencies. --- postCreate.sh | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 postCreate.sh diff --git a/postCreate.sh b/postCreate.sh new file mode 100644 index 0000000..8bc53a6 --- /dev/null +++ b/postCreate.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +git submodule update --init --recursive +pip install -r requirements.txt +pip install -r fast-pysf/requirements.txt +pip install -e . +pip install -e fast-pysf From 838a6f27d12e6383423c5e0225778bdfaf3ef43f Mon Sep 17 00:00:00 2001 From: ll7 Date: Wed, 29 May 2024 11:33:35 +0000 Subject: [PATCH 21/27] chore: Update devcontainer.json with additional VS Code extension and new post create command This commit adds the "ms-azuretools.vscode-docker" extension to the devcontainer.json file. This extension enhances the development experience by providing Docker-related functionality and tools within the VS Code editor. --- .devcontainer/devcontainer.json | 41 +++++++++++++++------------------ 1 file changed, 18 insertions(+), 23 deletions(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 809c11a..6fa65f3 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -6,32 +6,27 @@ "args": { "VARIANT": "sf-ll7" } - , + }, "runArgs": [ "--network=host", "-e", "DISPLAY=host.docker.internal:0.0" ], - "settings": { - "terminal.integrated.shell.linux": "/bin/bash" - }, - "postCreateCommand": [ - "git submodule update --init --recursive", - "pip install -r requirements.txt", - "pip install -r fast-pysf/requirements.txt", - "pip install -e .", - "pip install -e fast-pysf" - ] -}, -"customizations": { - "vscode": { - "extensions": [ - "ms-python.python", - "ms-vscode-remote.remote-containers", - "GitHub.vscode-pull-request-github", - "GitHub.copilot", - "mhutchie.git-graph", - "ms-python.pylint", - "genieai.chatgpt-vscode" - ] + "postCreateCommand": "./postCreate.sh", + "customizations": { + "vscode": { + "extensions": [ + "ms-python.python", + "ms-vscode-remote.remote-containers", + "GitHub.vscode-pull-request-github", + "GitHub.copilot", + "mhutchie.git-graph", + "ms-python.pylint", + "genieai.chatgpt-vscode", + "ms-azuretools.vscode-docker" + ] + }, + "settings": { + "terminal.integrated.shell.linux": "/bin/bash" + } } } \ No newline at end of file From 8a7cadc77d70700156bad5982ad70ca4f5c93e43 Mon Sep 17 00:00:00 2001 From: ll7 Date: Wed, 29 May 2024 11:33:46 +0000 Subject: [PATCH 22/27] chore: Update devcontainer Dockerfile to use nvidia/cuda:11.6.1-base-ubuntu20.04 This commit updates the devcontainer Dockerfile to use the nvidia/cuda:11.6.1-base-ubuntu20.04 base image instead of the nvidia/cuda:12.4.1-base-ubuntu22.04 image. This change is made to ensure compatibility with the CUDA version required for GPU acceleration in the development environment. --- .devcontainer/Dockerfile | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 46da38e..e5a703a 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -1,15 +1,23 @@ # Use the official Python base image -FROM nvidia/cuda:12.4.1-base-ubuntu22.04 +FROM nvidia/cuda:11.6.1-base-ubuntu20.04 -# Set git to auto adjust for the correct line endings between different operating systems -RUN git config --global core.autocrlf true +ENV DEBIAN_FRONTEND=noninteractive +RUN apt-get update \ + && apt-get -y install --no-install-recommends apt-utils 2>&1 + +# Verify git and needed tools are installed +RUN apt-get install --no-install-recommends -y git # Install necessary dependencies RUN apt-get update && \ - apt-get install -y python3 python3-pip python3-dev \ + apt-get install --no-install-recommends -y \ + python3 python-is-python3 python3-pip python3-dev \ python3-opengl libsdl2-dev libsdl2-image-dev libsdl2-mixer-dev libsdl2-ttf-dev \ libsmpeg-dev libportmidi-dev libavformat-dev libswscale-dev libjpeg-dev libfreetype6-dev +# Set git to auto adjust for the correct line endings between different operating systems +RUN git config --global core.autocrlf true + # Set the display environment variable ENV DISPLAY=host.docker.internal:0.0 From 046e99e66cd8c0572083c387cdf064289fd93dea Mon Sep 17 00:00:00 2001 From: ll7 Date: Wed, 29 May 2024 11:57:55 +0000 Subject: [PATCH 23/27] chore: Update devcontainer Dockerfile to use nvidia/cuda:12.4.1-base-ubuntu22.04 Helps with using python>=3.9 = 3.10 for typing issues --- .devcontainer/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index e5a703a..bfef153 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -1,5 +1,5 @@ # Use the official Python base image -FROM nvidia/cuda:11.6.1-base-ubuntu20.04 +FROM nvidia/cuda:12.4.1-base-ubuntu22.04 ENV DEBIAN_FRONTEND=noninteractive RUN apt-get update \ From 027d997507137758632580516d36de5627146b21 Mon Sep 17 00:00:00 2001 From: ll7 Date: Wed, 29 May 2024 11:58:50 +0000 Subject: [PATCH 24/27] Update devcontainer --- .devcontainer/Dockerfile | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index bfef153..6b9de22 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -11,7 +11,7 @@ RUN apt-get install --no-install-recommends -y git # Install necessary dependencies RUN apt-get update && \ apt-get install --no-install-recommends -y \ - python3 python-is-python3 python3-pip python3-dev \ + python3 python-is-python3 python3-pip python3-dev python3.10-venv \ python3-opengl libsdl2-dev libsdl2-image-dev libsdl2-mixer-dev libsdl2-ttf-dev \ libsmpeg-dev libportmidi-dev libavformat-dev libswscale-dev libjpeg-dev libfreetype6-dev @@ -21,5 +21,10 @@ RUN git config --global core.autocrlf true # Set the display environment variable ENV DISPLAY=host.docker.internal:0.0 +# Create a virtual environment and activate it +# Avoids pip complaint about being a root user in the docker container +RUN python3 -m venv /opt/venv +ENV PATH="/opt/venv/bin:$PATH" + # Update pip RUN pip install --upgrade pip From 83c9c91d133fa60cce1407526bd27379de3de34a Mon Sep 17 00:00:00 2001 From: ll7 Date: Wed, 29 May 2024 12:25:10 +0000 Subject: [PATCH 25/27] chore: Update devcontainer Dockerfile to use nvidia/cuda:12.4.1-runtime-ubuntu22.04 use runtime instead of base to have nvidia-smi to check gpu availability --- .devcontainer/Dockerfile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 6b9de22..4c4fbc5 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -1,5 +1,4 @@ -# Use the official Python base image -FROM nvidia/cuda:12.4.1-base-ubuntu22.04 +FROM nvidia/cuda:12.4.1-runtime-ubuntu22.04 ENV DEBIAN_FRONTEND=noninteractive RUN apt-get update \ From 1093b9876801d704476db8f57f8efdd8e936f20d Mon Sep 17 00:00:00 2001 From: ll7 Date: Wed, 29 May 2024 12:25:38 +0000 Subject: [PATCH 26/27] ```text chore: Update devcontainer.json to include "--gpus=all" in runArgs This commit modifies the devcontainer.json file to include the "--gpus=all" flag in the runArgs section. This flag enables GPU acceleration in the development environment, allowing for the use of GPUs for computational tasks. This change is made to ensure compatibility with the recent updates to the devcontainer Dockerfile that use the nvidia/cuda base image. --- .devcontainer/devcontainer.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 6fa65f3..6639a7c 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -9,7 +9,8 @@ }, "runArgs": [ "--network=host", - "-e", "DISPLAY=host.docker.internal:0.0" + "-e", "DISPLAY=host.docker.internal:0.0", + "--gpus=all" ], "postCreateCommand": "./postCreate.sh", "customizations": { From 68db4ef2203986b9b41b3bb48aaccc3ba4f7fa3e Mon Sep 17 00:00:00 2001 From: ll7 Date: Wed, 29 May 2024 12:27:07 +0000 Subject: [PATCH 27/27] chore: Update devcontainer.json to include "eamodio.gitlens" extension This commit adds the "eamodio.gitlens" extension to the devcontainer.json file. GitLens enhances the development experience by providing advanced Git functionality and tools within the VS Code editor. --- .devcontainer/devcontainer.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 6639a7c..6629302 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -23,7 +23,8 @@ "mhutchie.git-graph", "ms-python.pylint", "genieai.chatgpt-vscode", - "ms-azuretools.vscode-docker" + "ms-azuretools.vscode-docker", + "eamodio.gitlens" ] }, "settings": {