From 40573333c59d0fcdf300c492dc264fef98c62c39 Mon Sep 17 00:00:00 2001 From: Fabiano Weimar Date: Sat, 30 Nov 2024 14:30:09 +0000 Subject: [PATCH 1/6] Initial dev container implementation for vscode. --- .devcontainer/devcontainer.json | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 .devcontainer/devcontainer.json diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000000..2795526db9 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,18 @@ +// For format details, see https://aka.ms/devcontainer.json. For config options, see the +// README at: https://github.com/devcontainers/templates/tree/main/src/python +{ + "name": "Plone 6.1", + "image": "mcr.microsoft.com/devcontainers/python:1-3.12-bullseye" + + // Use 'portsAttributes' to set default properties for specific forwarded ports. + // More info: https://containers.dev/implementors/json_reference/#port-attributes + "portsAttributes": { + "8080": { + "label": "Plone Backend", + "onAutoForward": "notify" + } + }, + + // Use 'postCreateCommand' to run commands after the container is created. + "postCreateCommand": "pip3 install --user -r requirements.txt" +} From 1d319fb5ec1a4800f3b97a9b495e3ed6ae8e93ee Mon Sep 17 00:00:00 2001 From: Fabiano Weimar Date: Sat, 30 Nov 2024 14:33:23 +0000 Subject: [PATCH 2/6] Add missing comma. --- .devcontainer/devcontainer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 2795526db9..dfe708c4a9 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -2,7 +2,7 @@ // README at: https://github.com/devcontainers/templates/tree/main/src/python { "name": "Plone 6.1", - "image": "mcr.microsoft.com/devcontainers/python:1-3.12-bullseye" + "image": "mcr.microsoft.com/devcontainers/python:1-3.12-bullseye", // Use 'portsAttributes' to set default properties for specific forwarded ports. // More info: https://containers.dev/implementors/json_reference/#port-attributes From cccaf61d53a33354d0a6c1d5e30d68b21a273c77 Mon Sep 17 00:00:00 2001 From: Fabiano Weimar Date: Sat, 30 Nov 2024 12:20:28 -0300 Subject: [PATCH 3/6] Add plone build to the dev container. --- .devcontainer/devcontainer-build.sh | 5 +++++ .devcontainer/devcontainer.json | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100755 .devcontainer/devcontainer-build.sh diff --git a/.devcontainer/devcontainer-build.sh b/.devcontainer/devcontainer-build.sh new file mode 100755 index 0000000000..e0755c26c3 --- /dev/null +++ b/.devcontainer/devcontainer-build.sh @@ -0,0 +1,5 @@ +#/bin/sh +`which python3.12` -m venv . +./bin/pip install -r requirements.txt +./bin/buildout +echo "run plone with: ./bin/instance fg" diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index dfe708c4a9..11368063c7 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -14,5 +14,5 @@ }, // Use 'postCreateCommand' to run commands after the container is created. - "postCreateCommand": "pip3 install --user -r requirements.txt" + "postCreateCommand": "./.devcontainer/devcontainer-build.sh" } From 3c474af699d6e657b1648fe237ea3d17190ee8ce Mon Sep 17 00:00:00 2001 From: David Glick Date: Sat, 30 Nov 2024 16:06:23 -0300 Subject: [PATCH 4/6] Install with the new make command --- .devcontainer/Dockerfile | 10 ++++++++++ .devcontainer/devcontainer-build.sh | 5 ----- .devcontainer/devcontainer.json | 24 ++++++++++++------------ 3 files changed, 22 insertions(+), 17 deletions(-) create mode 100644 .devcontainer/Dockerfile delete mode 100755 .devcontainer/devcontainer-build.sh diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 0000000000..194e1c7968 --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,10 @@ +FROM python:3.12-slim-bullseye + +# Dev dependencies +RUN apt-get update \ + && apt-get install -y build-essential git libmagic1 libbz2-dev libjpeg62-turbo-dev zlib1g-dev --no-install-recommends \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* + +ENV PYTHONUNBUFFERED 1 +ENV PYTHONDONTWRITEBYTECODE 1 diff --git a/.devcontainer/devcontainer-build.sh b/.devcontainer/devcontainer-build.sh deleted file mode 100755 index e0755c26c3..0000000000 --- a/.devcontainer/devcontainer-build.sh +++ /dev/null @@ -1,5 +0,0 @@ -#/bin/sh -`which python3.12` -m venv . -./bin/pip install -r requirements.txt -./bin/buildout -echo "run plone with: ./bin/instance fg" diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 11368063c7..e2f4c4eab1 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,18 +1,18 @@ // For format details, see https://aka.ms/devcontainer.json. For config options, see the // README at: https://github.com/devcontainers/templates/tree/main/src/python { - "name": "Plone 6.1", - "image": "mcr.microsoft.com/devcontainers/python:1-3.12-bullseye", + "name": "Plone Coredev", + "build": { "dockerfile": "Dockerfile" }, - // Use 'portsAttributes' to set default properties for specific forwarded ports. - // More info: https://containers.dev/implementors/json_reference/#port-attributes - "portsAttributes": { - "8080": { - "label": "Plone Backend", - "onAutoForward": "notify" - } - }, + // Use 'portsAttributes' to set default properties for specific forwarded ports. + // More info: https://containers.dev/implementors/json_reference/#port-attributes + "portsAttributes": { + "8080": { + "label": "Plone Backend", + "onAutoForward": "notify" + } + }, - // Use 'postCreateCommand' to run commands after the container is created. - "postCreateCommand": "./.devcontainer/devcontainer-build.sh" + // Use 'postCreateCommand' to run commands after the container is created. + "postCreateCommand": "make install" } From adf3b9fcfe4c4407e27c13bc1b5dc87a1776ad0d Mon Sep 17 00:00:00 2001 From: David Glick Date: Sat, 30 Nov 2024 16:43:14 -0300 Subject: [PATCH 5/6] set up VHM --- .devcontainer/devcontainer.json | 2 +- setup-codespace.py | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 setup-codespace.py diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index e2f4c4eab1..8fc35c400a 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -14,5 +14,5 @@ }, // Use 'postCreateCommand' to run commands after the container is created. - "postCreateCommand": "make install" + "postCreateCommand": "make install && .venv/bin/zconsole run instance/etc/zope.conf setup-codespace.py" } diff --git a/setup-codespace.py b/setup-codespace.py new file mode 100644 index 0000000000..5cf3f48dc3 --- /dev/null +++ b/setup-codespace.py @@ -0,0 +1,9 @@ +import os +import transaction + +CODESPACE_NAME = os.environ.get("CODESPACE_NAME", None) +if CODESPACE_NAME: + DOMAIN = os.environ["GITHUB_CODESPACES_PORT_FORWARDING_DOMAIN"] + hostname = f"{CODESPACE_NAME}-8080.{DOMAIN}" + app.virtual_hosting.set_map(f"{hostname}/VirtualHostBase/https/{hostname}:443/VirtualHostRoot") + transaction.commit() From cf92d4daf41e3be4a2ed15aeb89b6cedb9535697 Mon Sep 17 00:00:00 2001 From: David Glick Date: Sat, 30 Nov 2024 16:54:26 -0300 Subject: [PATCH 6/6] fix vhm path --- setup-codespace.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup-codespace.py b/setup-codespace.py index 5cf3f48dc3..c87962dbed 100644 --- a/setup-codespace.py +++ b/setup-codespace.py @@ -5,5 +5,5 @@ if CODESPACE_NAME: DOMAIN = os.environ["GITHUB_CODESPACES_PORT_FORWARDING_DOMAIN"] hostname = f"{CODESPACE_NAME}-8080.{DOMAIN}" - app.virtual_hosting.set_map(f"{hostname}/VirtualHostBase/https/{hostname}:443/VirtualHostRoot") + app.virtual_hosting.set_map(f"localhost:8080/VirtualHostBase/https/{hostname}:443/VirtualHostRoot") transaction.commit()