From 0b7739310a289185f8d6b053b0fb35ce5a3b177e Mon Sep 17 00:00:00 2001 From: Andre Riesco Date: Tue, 30 Jan 2024 16:33:01 -0300 Subject: [PATCH 01/10] rustConsole: Update the SSH copy to COPY inside the container Signed-off-by: Andre Riesco --- rustConsole/.dockerignore | 1 - rustConsole/.gitignore | 4 ++- rustConsole/.vscode/launch.json | 12 +++---- rustConsole/.vscode/settings.json | 2 +- rustConsole/.vscode/tasks.json | 56 +++++++++++++++---------------- rustConsole/Dockerfile | 56 +++++++++++++++++-------------- rustConsole/Dockerfile.debug | 26 ++++++++++---- rustConsole/Dockerfile.sdk | 30 +++++++++++++++-- 8 files changed, 115 insertions(+), 72 deletions(-) diff --git a/rustConsole/.dockerignore b/rustConsole/.dockerignore index 0022d2630..91ac1b8f8 100644 --- a/rustConsole/.dockerignore +++ b/rustConsole/.dockerignore @@ -1,2 +1 @@ -target/ credentials.zip diff --git a/rustConsole/.gitignore b/rustConsole/.gitignore index 5c98c651f..b796c42a5 100644 --- a/rustConsole/.gitignore +++ b/rustConsole/.gitignore @@ -5,4 +5,6 @@ credentials.zip *.lock.yml .conf/.depok -.conf/.docok \ No newline at end of file +.conf/.docok + +executable-* \ No newline at end of file diff --git a/rustConsole/.vscode/launch.json b/rustConsole/.vscode/launch.json index 378eea80a..e376ccb4d 100644 --- a/rustConsole/.vscode/launch.json +++ b/rustConsole/.vscode/launch.json @@ -31,14 +31,14 @@ "name": "Torizon ARMv7", "type": "cppdbg", "request": "launch", - "program": "~/app/__change__", + "program": "${config:torizon_app_root}/__change__", "args": [], "stopAtEntry": false, - "cwd": "~/app", + "cwd": "${config:torizon_app_root}", "environment": [], "externalConsole": false, "sourceFileMap": { - "/app": "${workspaceFolder}" + "${config:torizon_app_root}": "${workspaceFolder}" }, "pipeTransport": { "debuggerPath": "/usr/bin/rust-gdb", @@ -76,14 +76,14 @@ "name": "Torizon ARMv8", "type": "cppdbg", "request": "launch", - "program": "~/app/__change__", + "program": "${config:torizon_app_root}/__change__", "args": [], "stopAtEntry": false, - "cwd": "~/app", + "cwd": "${config:torizon_app_root}", "environment": [], "externalConsole": false, "sourceFileMap": { - "/app": "${workspaceFolder}" + "${config:torizon_app_root}": "${workspaceFolder}" }, "pipeTransport": { "debuggerPath": "/usr/bin/rust-gdb", diff --git a/rustConsole/.vscode/settings.json b/rustConsole/.vscode/settings.json index a239d2b17..958bb2278 100644 --- a/rustConsole/.vscode/settings.json +++ b/rustConsole/.vscode/settings.json @@ -12,7 +12,7 @@ "torizon_arch": "", "wait_sync": "1", "torizon_run_as": "torizon", - "torizon_app_root": "/home/torizon", + "torizon_app_root": "/home/torizon/app", "tcb.packageName": "__change__", "tcb.version": "3.8.1" } diff --git a/rustConsole/.vscode/tasks.json b/rustConsole/.vscode/tasks.json index 6912b8dfa..90c4b40b0 100644 --- a/rustConsole/.vscode/tasks.json +++ b/rustConsole/.vscode/tasks.json @@ -42,12 +42,20 @@ "--rm", "-it", "-v", - "${workspaceFolder}:/app", + "${workspaceFolder}:${config:torizon_app_root}", "cross-toolchain-arm64-__container__", "cargo", "build", "--target", - "aarch64-unknown-linux-gnu" + "aarch64-unknown-linux-gnu", + "&&", + "mkdir", + "-p", + "executable-arm64", + "&&", + "cp", + "target/aarch64-unknown-linux-gnu/debug/__change__", + "executable-arm64", ], "problemMatcher": [ { @@ -78,22 +86,14 @@ "label": "deploy-torizon-arm64", "detail": "", "hide": true, - "command": "scp", + "command": "sleep", "type": "process", "args": [ - "-i", - "${workspaceFolder}/.conf/id_rsa", - "-o", - "UserKnownHostsFile=/dev/null", - "-o", - "StrictHostKeyChecking=no", - "-P", - "${config:torizon_debug_ssh_port}", - "-pr", - "${workspaceFolder}/target/aarch64-unknown-linux-gnu/debug", - "${config:torizon_run_as}@${config:torizon_ip}:~/app" + "1" ], "dependsOn": [ + "validate-settings", + "validate-arch-arm64", "copy-docker-compose", "pre-cleanup", "build-debug-arm64", @@ -120,12 +120,20 @@ "--rm", "-it", "-v", - "${workspaceFolder}:/app", + "${workspaceFolder}:${config:torizon_app_root}", "cross-toolchain-arm-__container__", "cargo", "build", "--target", - "armv7-unknown-linux-gnueabihf" + "armv7-unknown-linux-gnueabihf", + "&&", + "mkdir", + "-p", + "executable-arm", + "&&", + "cp", + "target/armv7-unknown-linux-gnueabihf/debug/__change__", + "executable-arm", ], "problemMatcher": [ { @@ -156,22 +164,14 @@ "label": "deploy-torizon-arm", "detail": "", "hide": true, - "command": "scp", + "command": "sleep", "type": "process", "args": [ - "-i", - "${workspaceFolder}/.conf/id_rsa", - "-o", - "UserKnownHostsFile=/dev/null", - "-o", - "StrictHostKeyChecking=no", - "-P", - "${config:torizon_debug_ssh_port}", - "-pr", - "${workspaceFolder}/target/armv7-unknown-linux-gnueabihf/debug", - "${config:torizon_run_as}@${config:torizon_ip}:~/app" + "1" ], "dependsOn": [ + "validate-settings", + "validate-arch-arm", "copy-docker-compose", "pre-cleanup", "build-debug-arm", diff --git a/rustConsole/Dockerfile b/rustConsole/Dockerfile index 5c8ffa8ab..edf1ebfc4 100644 --- a/rustConsole/Dockerfile +++ b/rustConsole/Dockerfile @@ -1,42 +1,40 @@ -ARG CROSS_SDK_BASE_TAG=3.2.1-bookworm +# ARGUMENTS -------------------------------------------------------------------- +## +# Base container version +## +ARG SDK_BASE_VERSION=1.74 ARG BASE_VERSION=3.2.1-bookworm ## # Board architecture -# arm or arm64 ## ARG IMAGE_ARCH= ## -# Application Name +# Directory of the application inside container ## -ARG APP_EXECUTABLE=__change__ +ARG APP_ROOT= # BUILD ------------------------------------------------------------------------ -FROM rust:1.48 AS Build +FROM rust:${SDK_BASE_VERSION} AS Build ARG IMAGE_ARCH -ARG APP_EXECUTABLE -ENV IMAGE_ARCH ${IMAGE_ARCH} +ARG APP_ROOT RUN apt-get update && \ apt-get install -y \ gcc-arm-linux-gnueabihf \ gcc-aarch64-linux-gnu \ # ADD YOUR PACKAGES HERE +# DO NOT REMOVE THIS LABEL: this is used for VS Code automation + # __torizon_packages_dev_start__ + # __torizon_packages_dev_end__ +# DO NOT REMOVE THIS LABEL: this is used for VS Code automation && \ apt-get clean && apt-get autoremove && \ rm -rf /var/lib/apt/lists/* -ARG UNAME=rustuser -ARG UID=1000 -ARG GID=1000 -RUN groupadd -g $GID -o $UNAME -RUN useradd -m -u $UID -g $GID -o -s /bin/bash $UNAME - -USER $UNAME - RUN if [ "$IMAGE_ARCH" = "arm64" ] ; then \ echo aarch64-unknown-linux-gnu > ~/rust-toolchain-arch.txt; \ elif [ "$IMAGE_ARCH" = "arm" ] ; then \ @@ -47,14 +45,13 @@ RUN if [ "$IMAGE_ARCH" = "arm64" ] ; then \ RUN rustup target add $(cat ~/rust-toolchain-arch.txt) -WORKDIR /app - -COPY . /app +COPY . ${APP_ROOT} +WORKDIR ${APP_ROOT} RUN TARGET=$(cat ~/rust-toolchain-arch.txt) && \ cargo build --release --target $TARGET && \ - mkdir -p target/deploy && \ - cp target/$TARGET/release/$APP_EXECUTABLE target/deploy + mkdir -p build && \ + cp -r target/$TARGET/release build # BUILD ------------------------------------------------------------------------ @@ -63,17 +60,24 @@ RUN TARGET=$(cat ~/rust-toolchain-arch.txt) && \ FROM --platform=linux/${IMAGE_ARCH} torizon/debian:${BASE_VERSION} AS Deploy ARG IMAGE_ARCH -ARG APP_EXECUTABLE -ENV APP_EXECUTABLE ${APP_EXECUTABLE} +ARG APP_ROOT RUN apt-get -y update && apt-get install -y --no-install-recommends \ # ADD YOUR PACKAGES HERE +# DO NOT REMOVE THIS LABEL: this is used for VS Code automation + # __torizon_packages_prod_start__ + # __torizon_packages_prod_end__ +# DO NOT REMOVE THIS LABEL: this is used for VS Code automation && apt-get clean && apt-get autoremove && rm -rf /var/lib/apt/lists/* -# copy the build -COPY --from=Build /app/target/deploy/${APP_EXECUTABLE} /usr/bin/${APP_EXECUTABLE} +# Copy the application compiled in the build step to the $APP_ROOT directory +# path inside the container, where $APP_ROOT is the torizon_app_root +# configuration defined in settings.json +COPY --from=Build ${APP_ROOT}/build/release/__change__ ${APP_ROOT}/__change__ -# ADD YOUR ARGUMENTS HERE -CMD ${APP_EXECUTABLE} +# "cd" (enter) into the APP_ROOT directory +WORKDIR ${APP_ROOT} +# Command executed in runtime when the container starts +CMD ["./__change__"] # DEPLOY ------------------------------------------------------------------------ diff --git a/rustConsole/Dockerfile.debug b/rustConsole/Dockerfile.debug index d4b859954..ac10e3623 100644 --- a/rustConsole/Dockerfile.debug +++ b/rustConsole/Dockerfile.debug @@ -4,17 +4,15 @@ ## ARG IMAGE_ARCH= - - ## # Base container version ## ARG BASE_VERSION=3.2.1-bookworm ## -# Application Name +# Directory of the application inside container ## -ARG APP_EXECUTABLE=app +ARG APP_ROOT= ## # Debug port @@ -35,9 +33,8 @@ FROM --platform=linux/${IMAGE_ARCH} \ ARG IMAGE_ARCH ARG SSH_DEBUG_PORT -ARG APP_EXECUTABLE +ARG APP_ROOT ARG SSHUSERNAME -ENV APP_EXECUTABLE ${APP_EXECUTABLE} # SSH for remote debug EXPOSE ${SSH_DEBUG_PORT} @@ -60,6 +57,18 @@ RUN apt-get -q -y update && \ apt-get clean && apt-get autoremove && \ rm -rf /var/lib/apt/lists/* +# automate for torizonPackages.json +RUN apt-get -q -y update && \ + apt-get -q -y install \ +# DO NOT REMOVE THIS LABEL: this is used for VS Code automation + # __torizon_packages_dev_start__ + # __torizon_packages_dev_end__ +# DO NOT REMOVE THIS LABEL: this is used for VS Code automation + && \ + apt-get clean && apt-get autoremove && \ + rm -rf /var/lib/apt/lists/* + + # ⚠️ DEBUG PURPOSES ONLY!! # copies RSA key to enable SSH login for user COPY .conf/id_rsa.pub /id_rsa.pub @@ -82,4 +91,9 @@ RUN mkdir /var/run/sshd && \ RUN rm -r /etc/ssh/ssh*key && \ dpkg-reconfigure openssh-server +# Copy the compiled application to the $APP_ROOT directory path inside the +# container, where $APP_ROOT is the torizon_app_root configuration defined +# in settings.json. +COPY --chown=$SSHUSERNAME:$SSHUSERNAME ./executable-${IMAGE_ARCH} ${APP_ROOT} + CMD [ "/usr/sbin/sshd", "-D" ] diff --git a/rustConsole/Dockerfile.sdk b/rustConsole/Dockerfile.sdk index 765be844e..d949a6d37 100644 --- a/rustConsole/Dockerfile.sdk +++ b/rustConsole/Dockerfile.sdk @@ -1,10 +1,34 @@ -FROM rust:1.74 +# ARGUMENTS -------------------------------------------------------------------- +## +# Board architecture +## +ARG IMAGE_ARCH= + +## +# Base container version +## +ARG SDK_BASE_VERSION=1.74 + +## +# Directory of the application inside container +## +ARG APP_ROOT= + +# BUILD ------------------------------------------------------------------------ +## +FROM rust:${SDK_BASE_VERSION} + +ARG APP_ROOT RUN apt-get update && \ apt-get install -y \ gcc-arm-linux-gnueabihf \ gcc-aarch64-linux-gnu \ # ADD YOUR PACKAGES HERE +# DO NOT REMOVE THIS LABEL: this is used for VS Code automation + # __torizon_packages_dev_start__ + # __torizon_packages_dev_end__ +# DO NOT REMOVE THIS LABEL: this is used for VS Code automation && \ apt-get clean && apt-get autoremove && \ rm -rf /var/lib/apt/lists/* @@ -12,7 +36,7 @@ RUN apt-get update && \ RUN rustup target add aarch64-unknown-linux-gnu && \ rustup target add armv7-unknown-linux-gnueabihf -ARG UNAME=rustuser +ARG UNAME=torizon ARG UID=1000 ARG GID=1000 RUN groupadd -g $GID -o $UNAME @@ -20,4 +44,4 @@ RUN useradd -m -u $UID -g $GID -o -s /bin/bash $UNAME USER $UNAME -WORKDIR /app +WORKDIR ${APP_ROOT} From dc758921f467982e7e5c4a3f2cad3116d643bbea Mon Sep 17 00:00:00 2001 From: Andre Riesco Date: Tue, 30 Jan 2024 16:37:01 -0300 Subject: [PATCH 02/10] cppSlint: Update the SSH copy to COPY inside the container Signed-off-by: Andre Riesco --- cppQML/Dockerfile | 1 - cppQML/Dockerfile.debug | 6 +-- cppQML/Dockerfile.sdk | 2 - cppSlint/.dockerignore | 1 + cppSlint/.vscode/launch.json | 21 ++++----- cppSlint/.vscode/settings.json | 2 +- cppSlint/.vscode/tasks.json | 82 ++++++++++------------------------ cppSlint/Dockerfile | 36 ++++++++------- cppSlint/Dockerfile.debug | 14 +++--- cppSlint/Dockerfile.sdk | 18 +++++++- 10 files changed, 81 insertions(+), 102 deletions(-) diff --git a/cppQML/Dockerfile b/cppQML/Dockerfile index d7b4578e6..f729ebe8e 100644 --- a/cppQML/Dockerfile +++ b/cppQML/Dockerfile @@ -10,7 +10,6 @@ ARG BASE_VERSION=3 ## # Board architecture -# arm or arm64 ## ARG IMAGE_ARCH= diff --git a/cppQML/Dockerfile.debug b/cppQML/Dockerfile.debug index b1c45056c..20ca00a43 100644 --- a/cppQML/Dockerfile.debug +++ b/cppQML/Dockerfile.debug @@ -4,8 +4,6 @@ ## ARG IMAGE_ARCH= - - ## # Base container version ## @@ -131,8 +129,8 @@ RUN mkdir /var/run/sshd && \ RUN rm -r /etc/ssh/ssh*key && \ dpkg-reconfigure openssh-server -# Copy the compiled application to the $APP_ROOT directory path inside the -# container, where $APP_ROOT is the torizon_app_root configuration defined +# Copy the compiled application to the $APP_ROOT directory path inside the +# container, where $APP_ROOT is the torizon_app_root configuration defined # in settings.json. COPY --chown=$SSHUSERNAME:$SSHUSERNAME ./build-${IMAGE_ARCH}/bin ${APP_ROOT} diff --git a/cppQML/Dockerfile.sdk b/cppQML/Dockerfile.sdk index 15120e1b3..dc303f174 100644 --- a/cppQML/Dockerfile.sdk +++ b/cppQML/Dockerfile.sdk @@ -4,8 +4,6 @@ ## ARG IMAGE_ARCH= - - ## # Base container version ## diff --git a/cppSlint/.dockerignore b/cppSlint/.dockerignore index 91ac1b8f8..232c84126 100644 --- a/cppSlint/.dockerignore +++ b/cppSlint/.dockerignore @@ -1 +1,2 @@ credentials.zip +build/*/CMakeFiles \ No newline at end of file diff --git a/cppSlint/.vscode/launch.json b/cppSlint/.vscode/launch.json index ca80e7286..890c3d0a4 100644 --- a/cppSlint/.vscode/launch.json +++ b/cppSlint/.vscode/launch.json @@ -30,15 +30,14 @@ "name": "Torizon AMD64", "type": "cppdbg", "request": "launch", - "program": "~/app/__change__", + "program": "${config:torizon_app_root}/__change__", "args": [], "stopAtEntry": false, - "cwd": "~/app", + "cwd": "${config:torizon_app_root}", "environment": [], "externalConsole": false, "sourceFileMap": { - "/home/torizon/app": "${workspaceFolder}/build/amd64", - "/app": "${workspaceFolder}" + "${config:torizon_app_root}": "${workspaceFolder}" }, "pipeTransport": { "debuggerPath": "/usr/bin/gdb", @@ -76,17 +75,16 @@ "name": "Torizon ARMv8", "type": "cppdbg", "request": "launch", - "program": "~/app/__change__", + "program": "${config:torizon_app_root}/__change__", "args": [ ], "stopAtEntry": false, - "cwd": "~/app", + "cwd": "${config:torizon_app_root}", "environment": [ ], "externalConsole": false, "sourceFileMap": { - "/home/torizon/app": "${workspaceFolder}/build/arm64", - "/app": "${workspaceFolder}" + "${config:torizon_app_root}": "${workspaceFolder}" }, "pipeTransport": { "debuggerPath": "/usr/bin/gdb", @@ -124,15 +122,14 @@ "name": "Torizon ARMv7", "type": "cppdbg", "request": "launch", - "program": "~/app/__change__", + "program": "${config:torizon_app_root}/__change__", "args": [], "stopAtEntry": false, - "cwd": "~/app", + "cwd": "${config:torizon_app_root}", "environment": [], "externalConsole": false, "sourceFileMap": { - "/home/torizon/app": "${workspaceFolder}/build/armhf", - "/app": "${workspaceFolder}" + "${config:torizon_app_root}": "${workspaceFolder}" }, "pipeTransport": { "debuggerPath": "/usr/bin/gdb", diff --git a/cppSlint/.vscode/settings.json b/cppSlint/.vscode/settings.json index 17e6a6064..2f86d6238 100644 --- a/cppSlint/.vscode/settings.json +++ b/cppSlint/.vscode/settings.json @@ -13,7 +13,7 @@ "torizon_arch": "", "wait_sync": "1", "torizon_run_as": "torizon", - "torizon_app_root": "/home/torizon", + "torizon_app_root": "/home/torizon/app", "tcb.packageName": "__change__", "tcb.version": "3.8.1" } diff --git a/cppSlint/.vscode/tasks.json b/cppSlint/.vscode/tasks.json index cf68f9c94..b41097a3e 100644 --- a/cppSlint/.vscode/tasks.json +++ b/cppSlint/.vscode/tasks.json @@ -16,7 +16,7 @@ "-o", "StrictHostKeyChecking=no", "${config:torizon_run_as}@${config:torizon_ip}", - "cd ~/app && gdbserver localhost:${config:torizon_debug_port2} __change__" + "cd ${config:torizon_app_root} && gdbserver localhost:${config:torizon_debug_port2} __change__" ], "dependsOrder": "sequence", "dependsOn": [ @@ -64,7 +64,7 @@ "-o", "StrictHostKeyChecking=no", "${config:torizon_run_as}@${config:torizon_ip}", - "cd ~/app && gdbserver localhost:${config:torizon_debug_port2} __change__" + "cd ${config:torizon_app_root} && gdbserver localhost:${config:torizon_debug_port2} __change__" ], "dependsOrder": "sequence", "dependsOn": [ @@ -91,7 +91,7 @@ "-o", "StrictHostKeyChecking=no", "${config:torizon_run_as}@${config:torizon_ip}", - "cd ~/app && gdbserver localhost:${config:torizon_debug_port2} __change__" + "cd ${config:torizon_app_root} && gdbserver localhost:${config:torizon_debug_port2} __change__" ], "dependsOrder": "sequence", "dependsOn": [ @@ -110,9 +110,9 @@ "type": "shell", "args": [ "-DCMAKE_BUILD_TYPE=Debug", - "-B", + "-B", "build/x86_64", - "-S", + "-S", "." ], "problemMatcher": [ @@ -175,7 +175,7 @@ "run", "--rm", "-v", - "${workspaceFolder}:/app", + "${workspaceFolder}:${config:torizon_app_root}", "cross-toolchain-arm64-__container__", "bash", "-c", @@ -203,7 +203,7 @@ "run", "--rm", "-v", - "${workspaceFolder}:/app", + "${workspaceFolder}:${config:torizon_app_root}", "cross-toolchain-arm64-__container__", "bash", "-c", @@ -231,7 +231,7 @@ "run", "--rm", "-v", - "${workspaceFolder}:/app", + "${workspaceFolder}:${config:torizon_app_root}", "cross-toolchain-arm64-__container__", "bash", "-c", @@ -253,20 +253,10 @@ "label": "deploy-torizon-arm64", "detail": "", "hide": true, - "command": "scp", + "command": "sleep", "type": "process", "args": [ - "-i", - "${workspaceFolder}/.conf/id_rsa", - "-o", - "UserKnownHostsFile=/dev/null", - "-o", - "StrictHostKeyChecking=no", - "-P", - "${config:torizon_debug_ssh_port}", - "-pr", - "${workspaceFolder}/build/arm64", - "${config:torizon_run_as}@${config:torizon_ip}:~/app" + "1" ], "dependsOn": [ "validate-settings", @@ -278,8 +268,6 @@ "push-container-torizon-debug-arm64", "pull-container-torizon-debug-arm64", "run-container-torizon-debug-arm64", - "wait-a-bit", - "pos-cleanup" ], "dependsOrder": "sequence", "problemMatcher": "$msCompile", @@ -298,11 +286,11 @@ "run", "--rm", "-v", - "${workspaceFolder}:/app", + "${workspaceFolder}:${config:torizon_app_root}", "cross-toolchain-arm-__container__", "bash", "-c", - "\"cmake -DCMAKE_BUILD_TYPE=Debug -B build/armhf -S .\"" + "\"cmake -DCMAKE_BUILD_TYPE=Debug -B build/arm -S .\"" ], "problemMatcher": [ "$gcc" @@ -326,11 +314,11 @@ "run", "--rm", "-v", - "${workspaceFolder}:/app", + "${workspaceFolder}:${config:torizon_app_root}", "cross-toolchain-arm-__container__", "bash", "-c", - "\"cmake --build build/armhf\"" + "\"cmake --build build/arm\"" ], "problemMatcher": [ "$gcc" @@ -354,11 +342,11 @@ "run", "--rm", "-v", - "${workspaceFolder}:/app", + "${workspaceFolder}:${config:torizon_app_root}", "cross-toolchain-arm-__container__", "bash", "-c", - "\"cmake --build build/armhf --target clean\"" + "\"cmake --build build/arm --target clean\"" ], "problemMatcher": [ "$gcc" @@ -376,20 +364,10 @@ "label": "deploy-torizon-arm", "detail": "", "hide": true, - "command": "scp", + "command": "sleep", "type": "process", "args": [ - "-i", - "${workspaceFolder}/.conf/id_rsa", - "-o", - "UserKnownHostsFile=/dev/null", - "-o", - "StrictHostKeyChecking=no", - "-P", - "${config:torizon_debug_ssh_port}", - "-pr", - "${workspaceFolder}/build/armhf", - "${config:torizon_run_as}@${config:torizon_ip}:~/app" + "1" ], "dependsOn": [ "validate-settings", @@ -401,8 +379,6 @@ "push-container-torizon-debug-arm", "pull-container-torizon-debug-arm", "run-container-torizon-debug-arm", - "wait-a-bit", - "pos-cleanup" ], "dependsOrder": "sequence", "problemMatcher": "$msCompile", @@ -421,7 +397,7 @@ "run", "--rm", "-v", - "${workspaceFolder}:/app", + "${workspaceFolder}:${config:torizon_app_root}", "cross-toolchain-amd64-__container__", "bash", "-c", @@ -449,7 +425,7 @@ "run", "--rm", "-v", - "${workspaceFolder}:/app", + "${workspaceFolder}:${config:torizon_app_root}", "cross-toolchain-amd64-__container__", "bash", "-c", @@ -477,7 +453,7 @@ "run", "--rm", "-v", - "${workspaceFolder}:/app", + "${workspaceFolder}:${config:torizon_app_root}", "cross-toolchain-amd64-__change__", "bash", "-c", @@ -499,20 +475,10 @@ "label": "deploy-torizon-amd64", "detail": "", "hide": true, - "command": "scp", + "command": "sleep", "type": "process", "args": [ - "-i", - "${workspaceFolder}/.conf/id_rsa", - "-o", - "UserKnownHostsFile=/dev/null", - "-o", - "StrictHostKeyChecking=no", - "-P", - "${config:torizon_debug_ssh_port}", - "-pr", - "${workspaceFolder}/amd64/debug", - "${config:torizon_run_as}@${config:torizon_ip}:~/app" + "1" ], "dependsOn": [ "validate-settings", @@ -524,8 +490,6 @@ "push-container-torizon-debug-amd64", "pull-container-torizon-debug-amd64", "run-container-torizon-debug-amd64", - "wait-a-bit", - "pos-cleanup" ], "dependsOrder": "sequence", "problemMatcher": "$msCompile", diff --git a/cppSlint/Dockerfile b/cppSlint/Dockerfile index 41a976820..5c144b923 100644 --- a/cppSlint/Dockerfile +++ b/cppSlint/Dockerfile @@ -1,16 +1,20 @@ -## using Slint v1.2.2 base images +# ARGUMENTS -------------------------------------------------------------------- +## +# Base container version +# Using Slint v1.4.1 base images +## ARG CROSS_SDK_BASE_TAG=3.0.9-bookworm-1.4.1 ARG BASE_VERSION=3.2.1 + ## # Board architecture -# arm or arm64 ## ARG IMAGE_ARCH= ## -# Application Name +# Directory of the application inside container ## -ARG APP_EXECUTABLE=__change__ +ARG APP_ROOT= ## # Board GPU vendor prefix @@ -23,8 +27,7 @@ FROM commontorizon/slint-sdk-${IMAGE_ARCH}:${CROSS_SDK_BASE_TAG} As Build ARG IMAGE_ARCH ARG GPU -ARG COMPILER_ARCH -ENV IMAGE_ARCH ${IMAGE_ARCH} +ARG APP_ROOT # Rust ENV RUSTUP_HOME=/rust @@ -49,8 +52,8 @@ ENV RUST_FONTCONFIG_DLOPEN=on # Default to Ninja ENV CMAKE_GENERATOR=Ninja -COPY . /app -WORKDIR /app +COPY . ${APP_ROOT} +WORKDIR ${APP_ROOT} RUN mkdir -p build \ && cd build \ @@ -65,8 +68,7 @@ FROM --platform=linux/${IMAGE_ARCH} torizon/wayland-base${GPU}:${BASE_VERSION} A ARG IMAGE_ARCH ARG GPU -ARG APP_EXECUTABLE -ENV APP_EXECUTABLE ${APP_EXECUTABLE} +ARG APP_ROOT # Install Slint dependencies RUN apt-get update \ @@ -96,15 +98,19 @@ RUN apt-get -y update && apt-get install -y --no-install-recommends \ # DO NOT REMOVE THIS LABEL: this is used for VS Code automation && apt-get clean && apt-get autoremove && rm -rf /var/lib/apt/lists/* -# copy the build -COPY --from=Build /app/build /app - # Default to the Skia backend for best performance ENV SLINT_BACKEND=winit-skia # Default to Slint running in fullscreen ENV SLINT_FULLSCREEN=1 -# ADD YOUR ARGUMENTS HERE -CMD [ "./app/__change__" ] +# Copy the application compiled in the build step to the $APP_ROOT directory +# path inside the container, where $APP_ROOT is the torizon_app_root +# configuration defined in settings.json +COPY --from=Build ${APP_ROOT}/build/${IMAGE_ARCH} ${APP_ROOT} + +# "cd" (enter) into the APP_ROOT directory +WORKDIR ${APP_ROOT} +# Command executed in runtime when the container starts +CMD ["./__change__"] # DEPLOY ------------------------------------------------------------------------ diff --git a/cppSlint/Dockerfile.debug b/cppSlint/Dockerfile.debug index 0dbb4f2ac..f7c4c435a 100644 --- a/cppSlint/Dockerfile.debug +++ b/cppSlint/Dockerfile.debug @@ -4,8 +4,6 @@ ## ARG IMAGE_ARCH= - - ## # Base container version # Using the Slint v1.4.1 base images @@ -13,9 +11,9 @@ ARG IMAGE_ARCH= ARG BASE_VERSION=3.0.9-bookworm-1.4.1 ## -# Application Name +# Application root directory inside the container ## -ARG APP_EXECUTABLE=__change__ +ARG APP_ROOT= ## # Debug port @@ -40,9 +38,8 @@ FROM commontorizon/slint-base-${IMAGE_ARCH}${GPU}:${BASE_VERSION} AS Debug ARG IMAGE_ARCH ARG GPU ARG SSH_DEBUG_PORT -ARG APP_EXECUTABLE +ARG APP_ROOT ARG SSHUSERNAME -ENV APP_EXECUTABLE ${APP_EXECUTABLE} # SSH for remote debug EXPOSE ${SSH_DEBUG_PORT} @@ -116,4 +113,9 @@ RUN mkdir /var/run/sshd && \ RUN rm -r /etc/ssh/ssh*key && \ dpkg-reconfigure openssh-server +# Copy the compiled application to the $APP_ROOT directory path inside the +# container, where $APP_ROOT is the torizon_app_root configuration defined +# in settings.json. +COPY --chown=$SSHUSERNAME:$SSHUSERNAME ./build/${IMAGE_ARCH} ${APP_ROOT} + CMD [ "/usr/sbin/sshd", "-D" ] diff --git a/cppSlint/Dockerfile.sdk b/cppSlint/Dockerfile.sdk index c60dbb445..dedbd8030 100644 --- a/cppSlint/Dockerfile.sdk +++ b/cppSlint/Dockerfile.sdk @@ -1,16 +1,30 @@ # ARGUMENTS -------------------------------------------------------------------- -## Using the Slint v1.4.1 base images +## +# Using the Slint v1.4.1 base images +## ARG CROSS_SDK_BASE_TAG=3.0.9-bookworm-1.4.1 +## +# Board architecture +## ARG IMAGE_ARCH= +## +# Board GPU vendor prefix +## ARG GPU= +## +# Directory of the application inside container +## +ARG APP_ROOT= + # BUILD ------------------------------------------------------------------------ FROM commontorizon/slint-sdk-${IMAGE_ARCH}:${CROSS_SDK_BASE_TAG} As Build ARG IMAGE_ARCH ARG GPU +ARG APP_ROOT # automate for torizonPackages.json RUN apt-get -q -y update && \ @@ -30,4 +44,4 @@ ENV SLINT_FULLSCREEN=1 USER torizon -WORKDIR /app +WORKDIR ${APP_ROOT} From 4241443dad0e720d1ec14de696acb203516f1e3e Mon Sep 17 00:00:00 2001 From: Andre Riesco Date: Wed, 31 Jan 2024 18:10:57 -0300 Subject: [PATCH 03/10] dotnetUno5FrameBuffer: Change remaining ~/app to torizon_app_root Signed-off-by: Andre Riesco --- dotnetUno5FrameBuffer/.vscode/tasks.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dotnetUno5FrameBuffer/.vscode/tasks.json b/dotnetUno5FrameBuffer/.vscode/tasks.json index 13b7dce53..0e0552f1b 100644 --- a/dotnetUno5FrameBuffer/.vscode/tasks.json +++ b/dotnetUno5FrameBuffer/.vscode/tasks.json @@ -169,7 +169,7 @@ "StrictHostKeyChecking=no", "-ttt", "${config:torizon_run_as}@${config:torizon_ip}", - "cd ~/app && DOTNET_MODIFIABLE_ASSEMBLIES=debug ./__change__.Skia.Linux.FrameBuffer" + "cd ${config:torizon_app_root} && DOTNET_MODIFIABLE_ASSEMBLIES=debug ./__change__.Skia.Linux.FrameBuffer" ], "dependsOn": [ "deploy-torizon-arm64" @@ -306,7 +306,7 @@ "args": [ "clean", "${workspaceFolder}/__change__.Skia.Linux.FrameBuffer/__change__.Skia.Linux.FrameBuffer.csproj", - "-c", + "-c", "Debug", "-r", "linux-arm64" From 04805fe235416a0621d8991131e4be053433e7d1 Mon Sep 17 00:00:00 2001 From: Andre Riesco Date: Wed, 31 Jan 2024 19:17:29 -0300 Subject: [PATCH 04/10] node: Update the SSH copy to COPY inside the container Signed-off-by: Andre Riesco --- nodeElectron/.conf/deps.json | 1 + nodeElectron/.vscode/launch.json | 8 +- nodeElectron/.vscode/settings.json | 2 +- nodeElectron/.vscode/tasks.json | 129 +++------------------------- nodeElectron/Dockerfile | 57 +++++++----- nodeElectron/Dockerfile.debug | 19 +++- nodeJSTypeScript/.vscode/tasks.json | 84 ------------------ nodeJSTypeScript/Dockerfile | 5 +- nodeJSTypeScript/Dockerfile.debug | 5 ++ 9 files changed, 78 insertions(+), 232 deletions(-) diff --git a/nodeElectron/.conf/deps.json b/nodeElectron/.conf/deps.json index b69cf9a5f..f75fce5e3 100644 --- a/nodeElectron/.conf/deps.json +++ b/nodeElectron/.conf/deps.json @@ -2,6 +2,7 @@ "packages": [ "openssh-client", "sshpass", + "rsync", "nodejs", "npm", "libatspi2.0-0", diff --git a/nodeElectron/.vscode/launch.json b/nodeElectron/.vscode/launch.json index 460eba878..0eea7a434 100644 --- a/nodeElectron/.vscode/launch.json +++ b/nodeElectron/.vscode/launch.json @@ -24,7 +24,7 @@ "port": "${config:torizon_debug_port2}", "webRoot": "${workspaceFolder}", "pathMapping": { - "file://${config:torizon_app_root}/app/resources/app/": "${workspaceFolder}/./", + "file://${config:torizon_app_root}/resources/app/": "${workspaceFolder}/./", }, "enableContentValidation": true, "trace": true, @@ -41,7 +41,7 @@ "sourceMaps": false, "continueOnAttach": true, "localRoot": "${workspaceFolder}", - "remoteRoot": "${config:torizon_app_root}/app/resources/app/", + "remoteRoot": "${config:torizon_app_root}/resources/app/", "preLaunchTask": "start-torizon-debug-amd64", "postDebugTask": "stop-torizon-debug" }, @@ -55,7 +55,7 @@ "sourceMaps": false, "continueOnAttach": true, "localRoot": "${workspaceFolder}", - "remoteRoot": "${config:torizon_app_root}/app/resources/app/", + "remoteRoot": "${config:torizon_app_root}/resources/app/", "preLaunchTask": "start-torizon-debug-arm", "postDebugTask": "stop-torizon-debug" }, @@ -69,7 +69,7 @@ "sourceMaps": false, "continueOnAttach": true, "localRoot": "${workspaceFolder}", - "remoteRoot": "${config:torizon_app_root}/app/resources/app/", + "remoteRoot": "${config:torizon_app_root}/resources/app/", "preLaunchTask": "start-torizon-debug-arm64", "postDebugTask": "stop-torizon-debug" }, diff --git a/nodeElectron/.vscode/settings.json b/nodeElectron/.vscode/settings.json index 872d9213c..8be607c7d 100644 --- a/nodeElectron/.vscode/settings.json +++ b/nodeElectron/.vscode/settings.json @@ -12,7 +12,7 @@ "torizon_arch": "", "wait_sync": "1", "torizon_run_as": "torizon", - "torizon_app_root": "/home/torizon", + "torizon_app_root": "/home/torizon/app", "tcb.packageName": "__change__", "tcb.version": "3.8.1" } diff --git a/nodeElectron/.vscode/tasks.json b/nodeElectron/.vscode/tasks.json index 61474fca9..55643f7d3 100644 --- a/nodeElectron/.vscode/tasks.json +++ b/nodeElectron/.vscode/tasks.json @@ -77,7 +77,7 @@ "-p", "${config:torizon_debug_ssh_port}", "${config:torizon_run_as}@${config:torizon_ip}", - "ssh -i ${config:torizon_app_root}/app/resources/app/.conf/id_rsa -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p ${config:torizon_debug_ssh_port} -L 0.0.0.0:${config:torizon_debug_port2}:localhost:${config:torizon_debug_port3} localhost -N >out2.log 2>err2.log &" + "ssh -i ${config:torizon_app_root}/resources/app/.conf/id_rsa -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p ${config:torizon_debug_ssh_port} -L 0.0.0.0:${config:torizon_debug_port2}:localhost:${config:torizon_debug_port3} localhost -N >out2.log 2>err2.log &" ], "dependsOrder": "sequence", "problemMatcher": "$msCompile", @@ -91,7 +91,7 @@ "detail": "", "hide": true, "command": "npx", - "type": "process", + "type": "shell", "options": { "cwd": "${workspaceFolder}" }, @@ -101,7 +101,12 @@ "-a", "armv7l", "-p", - "linux" + "linux", + "&&", + "rsync", + "-a", + "${workspaceFolder}/out/__change__-linux-armv7l/", + "${workspaceFolder}/out/__change__-linux-arm", ], "dependsOrder": "sequence", "icon": { @@ -109,32 +114,6 @@ "color": "terminal.ansiYellow" } }, - { - "label": "deploy-torizon-arm", - "detail": "", - "hide": true, - "command": "scp", - "type": "process", - "args": [ - "-i", - "${workspaceFolder}/.conf/id_rsa", - "-o", - "UserKnownHostsFile=/dev/null", - "-o", - "StrictHostKeyChecking=no", - "-P", - "${config:torizon_debug_ssh_port}", - "-pr", - "${workspaceFolder}/out/__change__-linux-armv7l", - "${config:torizon_run_as}@${config:torizon_ip}:~/app" - ], - "dependsOrder": "sequence", - "problemMatcher": "$msCompile", - "icon": { - "id": "flame", - "color": "terminal.ansiYellow" - } - }, { "label": "start-torizon-debug-arm", "detail": "", @@ -151,7 +130,7 @@ "-p", "${config:torizon_debug_ssh_port}", "${config:torizon_run_as}@${config:torizon_ip}", - "${config:torizon_app_root}/app/__change__ --no-sandbox --remote-debugging-port=${config:torizon_debug_port3} --inspect-brk=0.0.0.0:${config:torizon_debug_port} --ozone-platform=wayland >out.log 2>err.log &" + "${config:torizon_app_root}/__change__ --no-sandbox --remote-debugging-port=${config:torizon_debug_port3} --inspect-brk=0.0.0.0:${config:torizon_debug_port} --ozone-platform=wayland >out.log 2>err.log &" ], "dependsOn": [ "validate-settings", @@ -165,8 +144,6 @@ "pull-container-torizon-debug-arm", "run-container-torizon-debug-arm", "wait-a-bit", - "pos-cleanup", - "deploy-torizon-arm" ], "dependsOrder": "sequence", "problemMatcher": "$msCompile", @@ -198,57 +175,6 @@ "color": "terminal.ansiYellow" } }, - { - "label": "deploy-torizon-arm64", - "detail": "", - "hide": true, - "command": "scp", - "type": "process", - "args": [ - "-i", - "${workspaceFolder}/.conf/id_rsa", - "-o", - "UserKnownHostsFile=/dev/null", - "-o", - "StrictHostKeyChecking=no", - "-P", - "${config:torizon_debug_ssh_port}", - "-pr", - "${workspaceFolder}/out/__change__-linux-arm64", - "${config:torizon_run_as}@${config:torizon_ip}:~/app" - ], - "dependsOrder": "sequence", - "problemMatcher": "$msCompile", - "icon": { - "id": "flame", - "color": "terminal.ansiYellow" - } - }, - { - "label": "overwrite-libs-vivante", - "detail": "", - "hide": true, - "command": "ssh", - "type": "process", - "args": [ - "-i", - "${workspaceFolder}/.conf/id_rsa", - "-o", - "UserKnownHostsFile=/dev/null", - "-o", - "StrictHostKeyChecking=no", - "-p", - "${config:torizon_debug_ssh_port}", - "${config:torizon_run_as}@${config:torizon_ip}", - "if [ \"${config:torizon_gpu}\" = \"-vivante\" ]; then cp /usr/lib/aarch64-linux-gnu/libEGL.so ${config:torizon_app_root}/app/ && cp /usr/lib/aarch64-linux-gnu/libGLESv2.so ${config:torizon_app_root}/app/; fi" - ], - "dependsOrder": "sequence", - "problemMatcher": "$msCompile", - "icon": { - "id": "flame", - "color": "terminal.ansiYellow" - } - }, { "label": "start-torizon-debug-arm64", "detail": "", @@ -265,7 +191,7 @@ "-p", "${config:torizon_debug_ssh_port}", "${config:torizon_run_as}@${config:torizon_ip}", - "${config:torizon_app_root}/app/__change__ --no-sandbox --remote-debugging-port=${config:torizon_debug_port3} --inspect-brk=0.0.0.0:${config:torizon_debug_port} --ozone-platform=wayland --use-gl=egl --in-process-gpu >out.log 2>err.log &" + "${config:torizon_app_root}/__change__ --no-sandbox --remote-debugging-port=${config:torizon_debug_port3} --inspect-brk=0.0.0.0:${config:torizon_debug_port} --ozone-platform=wayland --use-gl=egl --in-process-gpu >out.log 2>err.log &" ], "dependsOn": [ "validate-settings", @@ -278,10 +204,7 @@ "push-container-torizon-debug-arm64", "pull-container-torizon-debug-arm64", "run-container-torizon-debug-arm64", - "wait-a-bit", - "pos-cleanup", - "deploy-torizon-arm64", - "overwrite-libs-vivante" + "wait-a-bit" ], "dependsOrder": "sequence", "problemMatcher": "$msCompile", @@ -313,32 +236,6 @@ "color": "terminal.ansiYellow" } }, - { - "label": "deploy-torizon-amd64", - "detail": "", - "hide": true, - "command": "scp", - "type": "process", - "args": [ - "-i", - "${workspaceFolder}/.conf/id_rsa", - "-o", - "UserKnownHostsFile=/dev/null", - "-o", - "StrictHostKeyChecking=no", - "-P", - "${config:torizon_debug_ssh_port}", - "-pr", - "${workspaceFolder}/out/__change__-linux-x64", - "${config:torizon_run_as}@${config:torizon_ip}:~/app" - ], - "dependsOrder": "sequence", - "problemMatcher": "$msCompile", - "icon": { - "id": "flame", - "color": "terminal.ansiYellow" - } - }, { "label": "start-torizon-debug-amd64", "detail": "", @@ -355,7 +252,7 @@ "-p", "${config:torizon_debug_ssh_port}", "${config:torizon_run_as}@${config:torizon_ip}", - "${config:torizon_app_root}/app/__change__ --no-sandbox --remote-debugging-port=${config:torizon_debug_port3} --inspect-brk=0.0.0.0:${config:torizon_debug_port} --ozone-platform=wayland >out.log 2>err.log &" + "${config:torizon_app_root}/__change__ --no-sandbox --remote-debugging-port=${config:torizon_debug_port3} --inspect-brk=0.0.0.0:${config:torizon_debug_port} --ozone-platform=wayland >out.log 2>err.log &" ], "dependsOn": [ "validate-settings", @@ -369,8 +266,6 @@ "pull-container-torizon-debug-amd64", "run-container-torizon-debug-amd64", "wait-a-bit", - "pos-cleanup", - "deploy-torizon-amd64" ], "dependsOrder": "sequence", "problemMatcher": "$msCompile", diff --git a/nodeElectron/Dockerfile b/nodeElectron/Dockerfile index 40047da68..bcfdcae58 100644 --- a/nodeElectron/Dockerfile +++ b/nodeElectron/Dockerfile @@ -4,17 +4,15 @@ ## ARG IMAGE_ARCH= - - ## # Base container version ## ARG BASE_VERSION=3.2.1 ## -# Application Name +# Directory of the application inside container ## -ARG APP_EXECUTABLE=__change__ +ARG APP_ROOT= ## # Board GPU vendor prefix @@ -30,8 +28,7 @@ FROM --platform=linux/${IMAGE_ARCH} \ ARG IMAGE_ARCH ARG GPU -ARG APP_EXECUTABLE -ENV APP_EXECUTABLE ${APP_EXECUTABLE} +ARG APP_ROOT # stick to bookworm on /etc/apt/sources.list.d RUN sed -i 's/sid/bookworm/g' /etc/apt/sources.list.d/debian.sources @@ -85,18 +82,30 @@ RUN curl -fsSL https://deb.nodesource.com/setup_18.x | bash - && \ RUN npm config set registry https://registry.npmjs.org/ RUN npm install -g npm@8.10.0 -COPY . /build -WORKDIR /build +COPY . ${APP_ROOT} +WORKDIR ${APP_ROOT} +# Remove the out directory, that has the debug build +RUN rm -rf ${APP_ROOT}/out -# build the application -# overwrite the EGL lib for vivante GPU -RUN npm install && \ - npx electron-forge package -a arm64 -p linux && \ - if [ "${GPU}" = "-vivante" ] || [ "${GPU}" = "-imx8" ]; then \ - cp /usr/lib/aarch64-linux-gnu/libEGL.so /build/out/__change__-linux-${IMAGE_ARCH} && \ - cp /usr/lib/aarch64-linux-gnu/libGLESv2.so /build/out/__change__-linux-${IMAGE_ARCH}; \ - fi +RUN npm install +# build the application +RUN if [ "${IMAGE_ARCH}" = "arm64" ]; then \ + npx electron-forge package -a arm64 -p linux; \ + elif [ "${IMAGE_ARCH}" = "arm" ]; then \ + npx electron-forge package -a armv7l -p linux; \ + else \ + npx electron-forge package -a x86 -p linux; \ + fi; + +# Copy the EGL lib inside the project's directory for vivante GPU +RUN if [ "${GPU}" = "-vivante" ] || [ "${GPU}" = "-imx8" ]; then \ + cp /usr/lib/aarch64-linux-gnu/libEGL.so ${APP_ROOT}/out/__change__-linux-${IMAGE_ARCH} && \ + cp /usr/lib/aarch64-linux-gnu/libGLESv2.so ${APP_ROOT}/out/__change__-linux-${IMAGE_ARCH}; \ + # If it is a armv7l, this renames the output directory with the name expected by the Deploy fase + elif [ "${IMAGE_ARCH}" = "arm" ]; then \ + mv ${APP_ROOT}/out/__change__-linux-armv7l ${APP_ROOT}/out/__change__-linux-${IMAGE_ARCH}; \ + fi; # BUILD ------------------------------------------------------------------------ @@ -107,8 +116,7 @@ FROM --platform=linux/${IMAGE_ARCH} \ ARG IMAGE_ARCH ARG GPU -ARG APP_EXECUTABLE -ENV APP_EXECUTABLE ${APP_EXECUTABLE} +ARG APP_ROOT # stick to bookworm on /etc/apt/sources.list.d RUN sed -i 's/sid/bookworm/g' /etc/apt/sources.list.d/debian.sources @@ -156,10 +164,17 @@ RUN apt-get -q -y update && \ RUN curl -fsSL https://deb.nodesource.com/setup_18.x | bash - && \ apt-get install -y nodejs -# copy the build -COPY --from=Build /build/out/__change__-linux-${IMAGE_ARCH} /app -WORKDIR /app +# Copy the application compiled in the build step to the $APP_ROOT directory +# path inside the container, where $APP_ROOT is the torizon_app_root +# configuration defined in settings.json +COPY --from=Build ${APP_ROOT}/out/__change__-linux-${IMAGE_ARCH} ${APP_ROOT} + +# "cd" (enter) into the APP_ROOT directory +WORKDIR ${APP_ROOT} +# Command executed in runtime when the container starts +# FIX: In this template arm32 is not working properly with egl, so if you are +# using an arm32 remove the "--use-gl=egl" and "--in-process-gpu" arguments. CMD [ "./__change__", "--no-sandbox", "--ozone-platform=wayland", "--use-gl=egl", "--in-process-gpu" ] # DEPLOY ----------------------------------------------------------------------- diff --git a/nodeElectron/Dockerfile.debug b/nodeElectron/Dockerfile.debug index 4f000b170..c4af37ecd 100644 --- a/nodeElectron/Dockerfile.debug +++ b/nodeElectron/Dockerfile.debug @@ -12,9 +12,9 @@ ARG IMAGE_ARCH= ARG BASE_VERSION=3.2.1 ## -# Application Name +# Directory of the application inside container ## -ARG APP_EXECUTABLE=__change__ +ARG APP_ROOT= ## # Debug port @@ -38,9 +38,8 @@ FROM --platform=linux/${IMAGE_ARCH} \ ARG IMAGE_ARCH ARG GPU ARG SSH_DEBUG_PORT -ARG APP_EXECUTABLE +ARG APP_ROOT ARG SSHUSERNAME -ENV APP_EXECUTABLE ${APP_EXECUTABLE} # SSH for remote debug EXPOSE ${SSH_DEBUG_PORT} @@ -134,4 +133,16 @@ RUN mkdir /var/run/sshd && \ RUN rm -r /etc/ssh/ssh*key && \ dpkg-reconfigure openssh-server + +# Copy the application compiled in the build step to the $APP_ROOT directory +# path inside the container, where $APP_ROOT is the torizon_app_root +# configuration defined in settings.json +COPY --chown=$SSHUSERNAME:$SSHUSERNAME ./out/__change__-linux-${IMAGE_ARCH} ${APP_ROOT} + +# Copy the EGL lib inside the project's directory for vivante GPU +RUN if [ "${GPU}" = "-vivante" ] || [ "${GPU}" = "-imx8" ]; then \ + cp /usr/lib/aarch64-linux-gnu/libEGL.so ${APP_ROOT} && \ + cp /usr/lib/aarch64-linux-gnu/libGLESv2.so ${APP_ROOT}; \ + fi + CMD [ "/usr/sbin/sshd", "-D" ] diff --git a/nodeJSTypeScript/.vscode/tasks.json b/nodeJSTypeScript/.vscode/tasks.json index 1b4c86c89..9804c7141 100644 --- a/nodeJSTypeScript/.vscode/tasks.json +++ b/nodeJSTypeScript/.vscode/tasks.json @@ -57,32 +57,6 @@ "color": "terminal.ansiYellow" } }, - { - "label": "deploy-torizon-arm", - "detail": "", - "hide": true, - "command": "scp", - "type": "process", - "args": [ - "-i", - "${workspaceFolder}/.conf/id_rsa", - "-o", - "UserKnownHostsFile=/dev/null", - "-o", - "StrictHostKeyChecking=no", - "-P", - "${config:torizon_debug_ssh_port}", - "-pr", - "${workspaceFolder}/out", - "${config:torizon_run_as}@${config:torizon_ip}:${config:torizon_app_root}" - ], - "dependsOrder": "sequence", - "problemMatcher": "$msCompile", - "icon": { - "id": "flame", - "color": "terminal.ansiYellow" - } - }, { "label": "start-torizon-debug-arm", "detail": "", @@ -113,8 +87,6 @@ "pull-container-torizon-debug-arm", "run-container-torizon-debug-arm", "wait-a-bit", - "pos-cleanup", - "deploy-torizon-arm" ], "dependsOrder": "sequence", "problemMatcher": "$msCompile", @@ -142,32 +114,6 @@ "color": "terminal.ansiYellow" } }, - { - "label": "deploy-torizon-arm64", - "detail": "", - "hide": true, - "command": "scp", - "type": "process", - "args": [ - "-i", - "${workspaceFolder}/.conf/id_rsa", - "-o", - "UserKnownHostsFile=/dev/null", - "-o", - "StrictHostKeyChecking=no", - "-P", - "${config:torizon_debug_ssh_port}", - "-pr", - "${workspaceFolder}/out", - "${config:torizon_run_as}@${config:torizon_ip}:${config:torizon_app_root}" - ], - "dependsOrder": "sequence", - "problemMatcher": "$msCompile", - "icon": { - "id": "flame", - "color": "terminal.ansiYellow" - } - }, { "label": "start-torizon-debug-arm64", "detail": "", @@ -198,8 +144,6 @@ "pull-container-torizon-debug-arm64", "run-container-torizon-debug-arm64", "wait-a-bit", - "pos-cleanup", - "deploy-torizon-arm64" ], "dependsOrder": "sequence", "problemMatcher": "$msCompile", @@ -227,32 +171,6 @@ "color": "terminal.ansiYellow" } }, - { - "label": "deploy-torizon-amd64", - "detail": "", - "hide": true, - "command": "scp", - "type": "process", - "args": [ - "-i", - "${workspaceFolder}/.conf/id_rsa", - "-o", - "UserKnownHostsFile=/dev/null", - "-o", - "StrictHostKeyChecking=no", - "-P", - "${config:torizon_debug_ssh_port}", - "-pr", - "${workspaceFolder}/out", - "${config:torizon_run_as}@${config:torizon_ip}:${config:torizon_app_root}" - ], - "dependsOrder": "sequence", - "problemMatcher": "$msCompile", - "icon": { - "id": "flame", - "color": "terminal.ansiYellow" - } - }, { "label": "start-torizon-debug-amd64", "detail": "", @@ -283,8 +201,6 @@ "pull-container-torizon-debug-amd64", "run-container-torizon-debug-amd64", "wait-a-bit", - "pos-cleanup", - "deploy-torizon-amd64" ], "dependsOrder": "sequence", "problemMatcher": "$msCompile", diff --git a/nodeJSTypeScript/Dockerfile b/nodeJSTypeScript/Dockerfile index 77d2b350a..d942ae342 100644 --- a/nodeJSTypeScript/Dockerfile +++ b/nodeJSTypeScript/Dockerfile @@ -77,6 +77,7 @@ ARG APP_ROOT RUN apt-get -q -y update && \ apt-get -q -y install \ curl \ + libatomic1 \ # DO NOT REMOVE THIS LABEL: this is used for VS Code automation # __torizon_packages_prod_start__ # __torizon_packages_prod_end__ @@ -94,9 +95,11 @@ RUN curl -fsSL https://deb.nodesource.com/setup_18.x | bash - && \ # path inside the container, where $APP_ROOT is the torizon_app_root # configuration defined in settings.json COPY --from=Build ${APP_ROOT}/out ${APP_ROOT}/out + +# "cd" (enter) into the APP_ROOT directory WORKDIR ${APP_ROOT} # Command executed in runtime when the container starts -CMD [ "node", "out/lib/index.js" ] +CMD [ "node", "out" ] # DEPLOY ----------------------------------------------------------------------- diff --git a/nodeJSTypeScript/Dockerfile.debug b/nodeJSTypeScript/Dockerfile.debug index 3daecda63..66d1cc9bc 100644 --- a/nodeJSTypeScript/Dockerfile.debug +++ b/nodeJSTypeScript/Dockerfile.debug @@ -106,4 +106,9 @@ RUN mkdir /var/run/sshd && \ RUN rm -r /etc/ssh/ssh*key && \ dpkg-reconfigure openssh-server +# Copy the compiled application to the $APP_ROOT directory path inside the +# container, where $APP_ROOT is the torizon_app_root configuration defined +# in settings.json. +COPY --chown=$SSHUSERNAME:$SSHUSERNAME ./out ${APP_ROOT} + CMD [ "/usr/sbin/sshd", "-D" ] From 72ebedfdf68a40556223d4699b45548f5ee125d8 Mon Sep 17 00:00:00 2001 From: Andre Riesco Date: Thu, 1 Feb 2024 17:28:39 -0300 Subject: [PATCH 05/10] rustSlint: Update the SSH copy to COPY inside the container Signed-off-by: Andre Riesco --- rustSlint/.gitignore | 4 ++- rustSlint/.vscode/launch.json | 12 +++---- rustSlint/.vscode/settings.json | 2 +- rustSlint/.vscode/tasks.json | 57 +++++++++++++++++---------------- rustSlint/Dockerfile | 38 ++++++++++++++-------- rustSlint/Dockerfile.debug | 25 +++++++++++---- rustSlint/Dockerfile.sdk | 21 ++++++++++-- 7 files changed, 100 insertions(+), 59 deletions(-) diff --git a/rustSlint/.gitignore b/rustSlint/.gitignore index 5c98c651f..b796c42a5 100644 --- a/rustSlint/.gitignore +++ b/rustSlint/.gitignore @@ -5,4 +5,6 @@ credentials.zip *.lock.yml .conf/.depok -.conf/.docok \ No newline at end of file +.conf/.docok + +executable-* \ No newline at end of file diff --git a/rustSlint/.vscode/launch.json b/rustSlint/.vscode/launch.json index a6e8dce7c..e960e0f2a 100644 --- a/rustSlint/.vscode/launch.json +++ b/rustSlint/.vscode/launch.json @@ -42,14 +42,14 @@ "name": "Torizon ARMv7", "type": "cppdbg", "request": "launch", - "program": "~/app", + "program": "${config:torizon_app_root}/__change__", "args": [], "stopAtEntry": false, - "cwd": "~/", + "cwd": "${config:torizon_app_root}", "environment": [], "externalConsole": false, "sourceFileMap": { - "/app": "${workspaceFolder}" + "${config:torizon_app_root}": "${workspaceFolder}" }, "pipeTransport": { "debuggerPath": "/usr/bin/rust-gdb", @@ -87,14 +87,14 @@ "name": "Torizon ARMv8", "type": "cppdbg", "request": "launch", - "program": "~/app", + "program": "${config:torizon_app_root}/__change__", "args": [], "stopAtEntry": false, - "cwd": "~/", + "cwd": "${config:torizon_app_root}", "environment": [], "externalConsole": false, "sourceFileMap": { - "/app": "${workspaceFolder}" + "${config:torizon_app_root}": "${workspaceFolder}" }, "pipeTransport": { "debuggerPath": "/usr/bin/rust-gdb", diff --git a/rustSlint/.vscode/settings.json b/rustSlint/.vscode/settings.json index c7a5ec482..a5d7729b8 100644 --- a/rustSlint/.vscode/settings.json +++ b/rustSlint/.vscode/settings.json @@ -12,7 +12,7 @@ "torizon_arch": "", "wait_sync": "1", "torizon_run_as": "torizon", - "torizon_app_root": "/home/torizon", + "torizon_app_root": "/home/torizon/app", "tcb.packageName": "__change__", "tcb.version": "3.8.1" } diff --git a/rustSlint/.vscode/tasks.json b/rustSlint/.vscode/tasks.json index 9ba040c20..358fa9643 100644 --- a/rustSlint/.vscode/tasks.json +++ b/rustSlint/.vscode/tasks.json @@ -42,12 +42,21 @@ "--rm", "-it", "-v", - "${workspaceFolder}:/app", + "${workspaceFolder}:${config:torizon_app_root}", "cross-toolchain-arm64-__container__", "cargo", "build", "--target", - "aarch64-unknown-linux-gnu" + "aarch64-unknown-linux-gnu", + "&&", + "mkdir", + "-p", + "executable-arm64", + "&&", + "cp", + "target/aarch64-unknown-linux-gnu/debug/__change__", + "executable-arm64" + ], "problemMatcher": [ { @@ -78,22 +87,14 @@ "label": "deploy-torizon-arm64", "detail": "", "hide": true, - "command": "scp", + "command": "sleep", "type": "process", "args": [ - "-i", - "${workspaceFolder}/.conf/id_rsa", - "-o", - "UserKnownHostsFile=/dev/null", - "-o", - "StrictHostKeyChecking=no", - "-P", - "${config:torizon_debug_ssh_port}", - "-pr", - "${workspaceFolder}/target/aarch64-unknown-linux-gnu/debug/__change__", - "${config:torizon_run_as}@${config:torizon_ip}:~/app" + "1" ], "dependsOn": [ + "validate-settings", + "validate-arch-arm64", "copy-docker-compose", "pre-cleanup", "build-debug-arm64", @@ -120,12 +121,20 @@ "--rm", "-it", "-v", - "${workspaceFolder}:/app", + "${workspaceFolder}:${config:torizon_app_root}", "cross-toolchain-arm-__container__", "cargo", "build", "--target", - "armv7-unknown-linux-gnueabihf" + "armv7-unknown-linux-gnueabihf", + "&&", + "mkdir", + "-p", + "executable-arm", + "&&", + "cp", + "target/armv7-unknown-linux-gnueabihf/debug/__change__", + "executable-arm" ], "problemMatcher": [ { @@ -156,22 +165,14 @@ "label": "deploy-torizon-arm", "detail": "", "hide": true, - "command": "scp", + "command": "sleep", "type": "process", "args": [ - "-i", - "${workspaceFolder}/.conf/id_rsa", - "-o", - "UserKnownHostsFile=/dev/null", - "-o", - "StrictHostKeyChecking=no", - "-P", - "${config:torizon_debug_ssh_port}", - "-pr", - "${workspaceFolder}/target/armv7-unknown-linux-gnueabihf/debug/__change__", - "${config:torizon_run_as}@${config:torizon_ip}:~/app" + "1" ], "dependsOn": [ + "validate-settings", + "validate-arch-arm", "copy-docker-compose", "pre-cleanup", "build-debug-arm", diff --git a/rustSlint/Dockerfile b/rustSlint/Dockerfile index 4d4b76283..1fa81872a 100644 --- a/rustSlint/Dockerfile +++ b/rustSlint/Dockerfile @@ -1,16 +1,20 @@ -## Using Slint v1.4.1 base images +# ARGUMENTS -------------------------------------------------------------------- +## +# Base container version +# Using Slint v1.4.1 base images +## ARG CROSS_SDK_BASE_TAG=3.0.9-bookworm-1.4.1 ARG BASE_VERSION=3.2.1 + ## # Board architecture -# arm or arm64 ## ARG IMAGE_ARCH= ## -# Application Name +# Directory of the application inside container ## -ARG APP_EXECUTABLE=__change__ +ARG APP_ROOT= ## # Board GPU vendor prefix @@ -24,7 +28,7 @@ FROM commontorizon/slint-sdk-${IMAGE_ARCH}:${CROSS_SDK_BASE_TAG} As Build ARG IMAGE_ARCH ARG GPU ARG COMPILER_ARCH -ARG APP_EXECUTABLE +ARG APP_ROOT ENV IMAGE_ARCH ${IMAGE_ARCH} RUN if [ "$IMAGE_ARCH" = "arm64" ] ; then \ @@ -55,23 +59,22 @@ RUN apt-get -q -y update && \ # Don't require font-config when the compiler runs ENV RUST_FONTCONFIG_DLOPEN=on -COPY . /app -WORKDIR /app +COPY . ${APP_ROOT} +WORKDIR ${APP_ROOT} # BUILD ------------------------------------------------------------------------ RUN TARGET=$(cat /rust-toolchain-arch.txt) && \ cargo build --release --target $TARGET && \ - mkdir -p target/deploy && \ - cp target/$TARGET/release/$APP_EXECUTABLE target/deploy + mkdir -p build && \ + cp -r target/$TARGET/release build # DEPLOY ------------------------------------------------------------------------ FROM --platform=linux/${IMAGE_ARCH} torizon/wayland-base${GPU}:${BASE_VERSION} AS Deploy ARG IMAGE_ARCH ARG GPU -ARG APP_EXECUTABLE -ENV APP_EXECUTABLE ${APP_EXECUTABLE} +ARG APP_ROOT # for vivante GPU we need some "special" sauce RUN apt-get -q -y update && \ @@ -98,15 +101,22 @@ RUN apt-get -y update && apt-get install -y --no-install-recommends \ # DO NOT REMOVE THIS LABEL: this is used for VS Code automation && apt-get clean && apt-get autoremove && rm -rf /var/lib/apt/lists/* -# copy the build -COPY --from=Build /app/target/deploy/${APP_EXECUTABLE} /app # Default to the Skia backend for best performance ENV SLINT_BACKEND=winit-skia # Default to Slint running in fullscreen ENV SLINT_FULLSCREEN=1 +# Copy the application compiled in the build step to the $APP_ROOT directory +# path inside the container, where $APP_ROOT is the torizon_app_root +# configuration defined in settings.json +COPY --from=Build ${APP_ROOT}/build/release/__change__ ${APP_ROOT}/__change__ + +# "cd" (enter) into the APP_ROOT directory +WORKDIR ${APP_ROOT} + + # ADD YOUR ARGUMENTS HERE -CMD [ "./app" ] +CMD [ "./__change__" ] # DEPLOY ------------------------------------------------------------------------ diff --git a/rustSlint/Dockerfile.debug b/rustSlint/Dockerfile.debug index e3873f435..40264cfe7 100644 --- a/rustSlint/Dockerfile.debug +++ b/rustSlint/Dockerfile.debug @@ -4,8 +4,6 @@ ## ARG IMAGE_ARCH= - - ## # Base container version # Using Slint v1.4.1 base images @@ -13,9 +11,9 @@ ARG IMAGE_ARCH= ARG BASE_VERSION=3.0.9-bookworm-1.4.1 ## -# Application Name +# Directory of the application inside container ## -ARG APP_EXECUTABLE=app +ARG APP_ROOT= ## # Debug port @@ -41,9 +39,8 @@ FROM commontorizon/slint-base-${IMAGE_ARCH}${GPU}:${BASE_VERSION} AS Debug ARG IMAGE_ARCH ARG GPU ARG SSH_DEBUG_PORT -ARG APP_EXECUTABLE +ARG APP_ROOT ARG SSHUSERNAME -ENV APP_EXECUTABLE ${APP_EXECUTABLE} # SSH for remote debug EXPOSE ${SSH_DEBUG_PORT} @@ -79,6 +76,17 @@ RUN apt-get -q -y update && \ apt-get clean && apt-get autoremove && \ rm -rf /var/lib/apt/lists/* +# automate for torizonPackages.json +RUN apt-get -q -y update && \ + apt-get -q -y install \ +# DO NOT REMOVE THIS LABEL: this is used for VS Code automation + # __torizon_packages_dev_start__ + # __torizon_packages_dev_end__ +# DO NOT REMOVE THIS LABEL: this is used for VS Code automation + && \ + apt-get clean && apt-get autoremove && \ + rm -rf /var/lib/apt/lists/* + # Default to the Skia backend for best performance ENV SLINT_BACKEND=winit-skia # Default to Slint running in fullscreen @@ -106,4 +114,9 @@ RUN mkdir /var/run/sshd && \ RUN rm -r /etc/ssh/ssh*key && \ dpkg-reconfigure openssh-server +# Copy the compiled application to the $APP_ROOT directory path inside the +# container, where $APP_ROOT is the torizon_app_root configuration defined +# in settings.json. +COPY --chown=$SSHUSERNAME:$SSHUSERNAME ./executable-${IMAGE_ARCH} ${APP_ROOT} + CMD [ "/usr/sbin/sshd", "-D" ] diff --git a/rustSlint/Dockerfile.sdk b/rustSlint/Dockerfile.sdk index 55cbd307b..39f2096b2 100644 --- a/rustSlint/Dockerfile.sdk +++ b/rustSlint/Dockerfile.sdk @@ -1,9 +1,23 @@ # ARGUMENTS -------------------------------------------------------------------- -## Using Slint v1.4.1 base images +## +# Board architecture +## +ARG IMAGE_ARCH= + +## +# Base container version +# Using Slint v1.4.1 base images +## ARG CROSS_SDK_BASE_TAG=3.0.9-bookworm-1.4.1 -ARG IMAGE_ARCH= +## +# Directory of the application inside container +## +ARG APP_ROOT= +## +# Board GPU vendor prefix +## ARG GPU= # BUILD ------------------------------------------------------------------------ @@ -11,6 +25,7 @@ FROM commontorizon/slint-sdk-${IMAGE_ARCH}:${CROSS_SDK_BASE_TAG} As Build ARG IMAGE_ARCH ARG GPU +ARG APP_ROOT RUN if [ "$IMAGE_ARCH" = "arm64" ] ; then \ echo aarch64-unknown-linux-gnu > /rust-toolchain-arch.txt; \ @@ -54,4 +69,4 @@ ENV SLINT_BACKEND=winit-skia # Default to Slint running in fullscreen ENV SLINT_FULLSCREEN=1 -WORKDIR /app +WORKDIR ${APP_ROOT} From 9b9806efac5ddc2235927fec9868137ffbc3b640 Mon Sep 17 00:00:00 2001 From: Andre Riesco Date: Fri, 2 Feb 2024 13:43:34 -0300 Subject: [PATCH 06/10] zigConsole: Update the SSH copy to COPY in container and fix Dockerfile Signed-off-by: Andre Riesco --- zigConsole/.gitignore | 4 +- zigConsole/.vscode/launch.json | 108 ++----------------------------- zigConsole/.vscode/settings.json | 2 +- zigConsole/.vscode/tasks.json | 58 +++++++++-------- zigConsole/Dockerfile | 51 ++++++++------- zigConsole/Dockerfile.debug | 14 ++-- zigConsole/Dockerfile.sdk | 27 +++++++- 7 files changed, 99 insertions(+), 165 deletions(-) diff --git a/zigConsole/.gitignore b/zigConsole/.gitignore index f3162a29f..a1e689d43 100644 --- a/zigConsole/.gitignore +++ b/zigConsole/.gitignore @@ -1 +1,3 @@ -zig-*/ \ No newline at end of file +zig-*/ + +executable-* \ No newline at end of file diff --git a/zigConsole/.vscode/launch.json b/zigConsole/.vscode/launch.json index 7eebe50ec..9b791045e 100644 --- a/zigConsole/.vscode/launch.json +++ b/zigConsole/.vscode/launch.json @@ -27,117 +27,21 @@ ], "preLaunchTask": "build-debug-amd64" }, - { - "name": "Torizon riscv64", - "type": "cppdbg", - "request": "launch", - "program": "~/app/__change__", - "args": [], - "stopAtEntry": false, - "cwd": "~/app", - "environment": [], - "externalConsole": false, - "logging": { - "engineLogging": true, - }, - "sourceFileMap": { - "/app": "${workspaceFolder}" - }, - "pipeTransport": { - "debuggerPath": "/usr/bin/gdb", - "pipeProgram": "ssh", - "pipeArgs": [ - "-T", - "-q", - "-p", - "${config:torizon_debug_ssh_port}", - "-i", - "${workspaceFolder}/.conf/id_rsa", // ssh key path - "-o", - "StrictHostKeyChecking=no", - "-o", - "UserKnownHostsFile /dev/null", - "${config:torizon_run_as}@${config:torizon_ip}" // user@device - ] - }, - "MIMode": "gdb", - "setupCommands": [ - { - "description": "Enable pretty-printing for gdb", - "text": "-enable-pretty-printing", - "ignoreFailures": true - }, - { - "description": "Set Disassembly Flavor to Intel", - "text": "-gdb-set disassembly-flavor intel", - "ignoreFailures": true - } - ], - "preLaunchTask": "deploy-torizon-riscv64" - }, - { - "name": "Torizon AMD64", - "type": "cppdbg", - "request": "launch", - "program": "~/app/__change__", - "args": [], - "stopAtEntry": false, - "cwd": "~/app", - "environment": [], - "externalConsole": false, - "logging": { - "engineLogging": true, - }, - "sourceFileMap": { - "/app": "${workspaceFolder}" - }, - "pipeTransport": { - "debuggerPath": "/usr/bin/gdb", - "pipeProgram": "ssh", - "pipeArgs": [ - "-T", - "-q", - "-p", - "${config:torizon_debug_ssh_port}", - "-i", - "${workspaceFolder}/.conf/id_rsa", // ssh key path - "-o", - "StrictHostKeyChecking=no", - "-o", - "UserKnownHostsFile /dev/null", - "${config:torizon_run_as}@${config:torizon_ip}" // user@device - ] - }, - "MIMode": "gdb", - "setupCommands": [ - { - "description": "Enable pretty-printing for gdb", - "text": "-enable-pretty-printing", - "ignoreFailures": true - }, - { - "description": "Set Disassembly Flavor to Intel", - "text": "-gdb-set disassembly-flavor intel", - "ignoreFailures": true - } - ], - "preLaunchTask": "deploy-torizon-amd64" - }, { "name": "Torizon ARMv7", "type": "cppdbg", "request": "launch", - "program": "~/app/__change__", + "program": "${config:torizon_app_root}/__change__", "args": [], "stopAtEntry": false, - "cwd": "~/app", + "cwd": "${config:torizon_app_root}", "environment": [], "externalConsole": false, "logging": { "engineLogging": true, }, "sourceFileMap": { - "/app": "${workspaceFolder}" + "${config:torizon_app_root}": "${workspaceFolder}" }, "pipeTransport": { "debuggerPath": "/usr/bin/gdb", @@ -175,17 +79,17 @@ "name": "Torizon ARMv8", "type": "cppdbg", "request": "launch", - "program": "~/app/__change__", + "program": "${config:torizon_app_root}/__change__", "args": [], "stopAtEntry": false, - "cwd": "~/app", + "cwd": "${config:torizon_app_root}", "environment": [], "externalConsole": false, "logging": { "engineLogging": true, }, "sourceFileMap": { - "/app": "${workspaceFolder}" + "${config:torizon_app_root}": "${workspaceFolder}" }, "pipeTransport": { "debuggerPath": "/usr/bin/gdb", diff --git a/zigConsole/.vscode/settings.json b/zigConsole/.vscode/settings.json index 950f3b456..ee9de84f2 100644 --- a/zigConsole/.vscode/settings.json +++ b/zigConsole/.vscode/settings.json @@ -12,7 +12,7 @@ "torizon_arch": "", "wait_sync": "1", "torizon_run_as": "torizon", - "torizon_app_root": "/home/torizon", + "torizon_app_root": "/home/torizon/app", "tcb.packageName": "__change__", "tcb.version": "early-access" } diff --git a/zigConsole/.vscode/tasks.json b/zigConsole/.vscode/tasks.json index 31776cade..172a894fd 100644 --- a/zigConsole/.vscode/tasks.json +++ b/zigConsole/.vscode/tasks.json @@ -42,11 +42,20 @@ "--rm", "-it", "-v", - "${workspaceFolder}:/app", + "${workspaceFolder}:${config:torizon_app_root}", "cross-toolchain-arm64-__container__", "zig", "build", - "-Dtarget=aarch64-linux-gnu" + "-Dtarget=aarch64-linux-gnu", + "&&", + "mkdir", + "-p", + "executable-arm64", + "&&", + "cp", + "-r", + "zig-out/aarch64/Debug/bin/*", + "executable-arm64" ], "problemMatcher": [ { @@ -77,22 +86,14 @@ "label": "deploy-torizon-arm64", "detail": "", "hide": true, - "command": "scp", + "command": "sleep", "type": "process", "args": [ - "-i", - "${workspaceFolder}/.conf/id_rsa", - "-o", - "UserKnownHostsFile=/dev/null", - "-o", - "StrictHostKeyChecking=no", - "-P", - "${config:torizon_debug_ssh_port}", - "-pr", - "${workspaceFolder}/zig-out/aarch64/Debug/bin", - "${config:torizon_run_as}@${config:torizon_ip}:~/app" + "1" ], "dependsOn": [ + "validate-settings", + "validate-arch-arm64", "copy-docker-compose", "pre-cleanup", "build-debug-arm64", @@ -119,11 +120,20 @@ "--rm", "-it", "-v", - "${workspaceFolder}:/app", + "${workspaceFolder}:${config:torizon_app_root}", "cross-toolchain-arm-__container__", "zig", "build", - "-Dtarget=arm-linux-gnu" + "-Dtarget=arm-linux-gnu", + "&&", + "mkdir", + "-p", + "executable-arm", + "&&", + "cp", + "-r", + "zig-out/arm/Debug/bin/*", + "executable-arm" ], "problemMatcher": [ { @@ -154,22 +164,14 @@ "label": "deploy-torizon-arm", "detail": "", "hide": true, - "command": "scp", + "command": "sleep", "type": "process", "args": [ - "-i", - "${workspaceFolder}/.conf/id_rsa", - "-o", - "UserKnownHostsFile=/dev/null", - "-o", - "StrictHostKeyChecking=no", - "-P", - "${config:torizon_debug_ssh_port}", - "-pr", - "${workspaceFolder}/zig-out/arm/Debug/bin", - "${config:torizon_run_as}@${config:torizon_ip}:~/app" + "1" ], "dependsOn": [ + "validate-settings", + "validate-arch-arm", "copy-docker-compose", "pre-cleanup", "build-debug-arm", diff --git a/zigConsole/Dockerfile b/zigConsole/Dockerfile index aa250123b..71bb5f09f 100644 --- a/zigConsole/Dockerfile +++ b/zigConsole/Dockerfile @@ -1,23 +1,27 @@ -ARG CROSS_SDK_BASE_TAG=3.2.1-bookworm +# ARGUMENTS -------------------------------------------------------------------- +## +# Base container version +## +ARG SDK_BASE_VERSION=3.2.1-bookworm ARG BASE_VERSION=3.2.1-bookworm + ## # Board architecture -# arm or arm64 ## ARG IMAGE_ARCH= ## -# Application Name +# Directory of the application inside container ## -ARG APP_EXECUTABLE=__change__ +ARG APP_ROOT= # BUILD ------------------------------------------------------------------------ -FROM torizon/debian-cross-toolchain-${IMAGE_ARCH}:${CROSS_SDK_BASE_TAG} As Build +FROM torizon/debian-cross-toolchain-${IMAGE_ARCH}:${SDK_BASE_VERSION} As Build ARG IMAGE_ARCH ARG COMPILER_ARCH -ENV IMAGE_ARCH ${IMAGE_ARCH} +ARG APP_ROOT ENV ZIG_PATH /zig/0.11.0/files # __deps__ @@ -53,13 +57,6 @@ RUN if [ "$IMAGE_ARCH" = "arm64" ] ; then \ RUN chmod +x ${ZIG_PATH}/zig -ARG UNAME=ziguana -ARG UID=1000 -ARG GID=1000 -RUN groupadd -g $GID -o $UNAME -RUN useradd -m -u $UID -g $GID -o -s /bin/bash $UNAME - -USER $UNAME # default linux-libc: host - glibc (most), cross-compilation - musl (static) # zig pure-code (no ffi), no need libc linking @@ -70,8 +67,8 @@ USER $UNAME # C++: zig uses llvm-libcxx/abi + llvm-unwind on almost all (LLVM)targets. [builtin static-linking] -WORKDIR /app -COPY . /app +COPY . ${APP_ROOT} +WORKDIR ${APP_ROOT} # zig optimizers: # (Debug | ReleaseSafe) w/ dbg-info + runtime stacktrace (compiler safety), @@ -84,23 +81,22 @@ RUN if [ "$IMAGE_ARCH" = "arm64" ] ; then \ zig build -Doptimize=ReleaseSmall -Dtarget=x86_64-linux-gnu --summary all -freference-trace ; \ fi -# BUILD ------------------------------------------------------------------------ - RUN mkdir -p target/deploy && \ if [ "$IMAGE_ARCH" = "arm64" ] ; then \ - cp zig-out/aarch64/ReleaseSmall/bin/$APP_EXECUTABLE target/deploy ; \ + cp -r zig-out/aarch64/ReleaseSmall/bin/* target/deploy ; \ elif [ "$IMAGE_ARCH" = "arm" ] ; then \ - cp zig-out/arm/ReleaseSmall/bin/$APP_EXECUTABLE target/deploy ; \ + cp -r zig-out/arm/ReleaseSmall/bin/* target/deploy ; \ elif [ "$IMAGE_ARCH" = "amd64" ] ; then \ cp zig-out/x86_64/ReleaseSmall/bin/$APP_EXECUTABLE target/deploy ; \ fi +# BUILD ------------------------------------------------------------------------ + # DEPLOY ------------------------------------------------------------------------ FROM --platform=linux/${IMAGE_ARCH} torizon/debian:${BASE_VERSION} AS Deploy ARG IMAGE_ARCH -ARG APP_EXECUTABLE -ENV APP_EXECUTABLE ${APP_EXECUTABLE} +ARG APP_ROOT RUN apt-get -y update && apt-get install -y --no-install-recommends \ # DO NOT REMOVE THIS LABEL: this is used for VS Code automation @@ -109,10 +105,15 @@ RUN apt-get -y update && apt-get install -y --no-install-recommends \ # DO NOT REMOVE THIS LABEL: this is used for VS Code automation && apt-get clean && apt-get autoremove && rm -rf /var/lib/apt/lists/* -# copy the build -COPY --from=Build /app/target/deploy/${APP_EXECUTABLE} /usr/bin/${APP_EXECUTABLE} +# Copy the application compiled in the build step to the $APP_ROOT directory +# path inside the container, where $APP_ROOT is the torizon_app_root +# configuration defined in settings.json +COPY --from=Build ${APP_ROOT}/target/deploy/__change__ ${APP_ROOT}/__change__ + +# "cd" (enter) into the APP_ROOT directory +WORKDIR ${APP_ROOT} -# ADD YOUR ARGUMENTS HERE -CMD ${APP_EXECUTABLE} +# Command executed in runtime when the container starts +CMD ["./__change__"] # DEPLOY ------------------------------------------------------------------------ diff --git a/zigConsole/Dockerfile.debug b/zigConsole/Dockerfile.debug index 695cd3919..d33663c98 100644 --- a/zigConsole/Dockerfile.debug +++ b/zigConsole/Dockerfile.debug @@ -4,17 +4,15 @@ ## ARG IMAGE_ARCH= - - ## # Base container version ## ARG BASE_VERSION=3.2.1-bookworm ## -# Application Name +# Directory of the application inside container ## -ARG APP_EXECUTABLE=app +ARG APP_ROOT= ## # Debug port @@ -35,9 +33,8 @@ FROM --platform=linux/${IMAGE_ARCH} \ ARG IMAGE_ARCH ARG SSH_DEBUG_PORT -ARG APP_EXECUTABLE +ARG APP_ROOT ARG SSHUSERNAME -ENV APP_EXECUTABLE ${APP_EXECUTABLE} # SSH for remote debug EXPOSE ${SSH_DEBUG_PORT} @@ -91,4 +88,9 @@ RUN mkdir /var/run/sshd && \ RUN rm -r /etc/ssh/ssh*key && \ dpkg-reconfigure openssh-server +# Copy the compiled application to the $APP_ROOT directory path inside the +# container, where $APP_ROOT is the torizon_app_root configuration defined +# in settings.json. +COPY --chown=$SSHUSERNAME:$SSHUSERNAME ./executable-${IMAGE_ARCH} ${APP_ROOT} + CMD [ "/usr/sbin/sshd", "-D" ] diff --git a/zigConsole/Dockerfile.sdk b/zigConsole/Dockerfile.sdk index 2e775d5a4..5c12f263e 100644 --- a/zigConsole/Dockerfile.sdk +++ b/zigConsole/Dockerfile.sdk @@ -1,8 +1,31 @@ -FROM kassany/bookworm-ziglang:0.11.0 +# ARGUMENTS -------------------------------------------------------------------- +## +# Board architecture +## +ARG IMAGE_ARCH= + +## +# Base container version +## +ARG SDK_BASE_VERSION=0.11.0 + +## +# Directory of the application inside container +## +ARG APP_ROOT= + +# BUILD ------------------------------------------------------------------------ +FROM kassany/bookworm-ziglang:${SDK_BASE_VERSION} + +ARG APP_ROOT RUN apt-get update && \ apt-get install -y \ # ADD YOUR PACKAGES HERE +# DO NOT REMOVE THIS LABEL: this is used for VS Code automation + # __torizon_packages_dev_start__ + # __torizon_packages_dev_end__ +# DO NOT REMOVE THIS LABEL: this is used for VS Code automation && \ apt-get clean && apt-get autoremove && \ rm -rf /var/lib/apt/lists/* @@ -15,4 +38,4 @@ RUN useradd -m -u $UID -g $GID -o -s /bin/bash $UNAME USER $UNAME -WORKDIR /app +WORKDIR ${APP_ROOT} From 803ba16e5fef2707f8736f5c787697bc60f18945 Mon Sep 17 00:00:00 2001 From: Andre Riesco Date: Fri, 2 Feb 2024 15:02:34 -0300 Subject: [PATCH 07/10] javaForms: Update the SSH copy to COPY inside the container Signed-off-by: Andre Riesco --- javaForms/.vscode/settings.json | 2 +- javaForms/.vscode/tasks.json | 96 ++------------------------------- javaForms/Dockerfile | 28 ++++++---- javaForms/Dockerfile.debug | 16 ++++-- 4 files changed, 35 insertions(+), 107 deletions(-) diff --git a/javaForms/.vscode/settings.json b/javaForms/.vscode/settings.json index 70fb1daee..b88597a51 100644 --- a/javaForms/.vscode/settings.json +++ b/javaForms/.vscode/settings.json @@ -12,7 +12,7 @@ "torizon_arch": "aarch64", "wait_sync": "1", "torizon_run_as": "torizon", - "torizon_app_root": "/home/torizon", + "torizon_app_root": "/home/torizon/app", "tcb.packageName": "__change__", "tcb.version": "3.8.1", "torizon.gpuPrefixRC": true, diff --git a/javaForms/.vscode/tasks.json b/javaForms/.vscode/tasks.json index b6a4e868e..5adae0d2a 100644 --- a/javaForms/.vscode/tasks.json +++ b/javaForms/.vscode/tasks.json @@ -125,84 +125,6 @@ "generate-jar" ] }, - { - "label": "deploy-application", - "detail": "", - "hide": true, - "command": "scp", - "type": "process", - "args": [ - "-i", - "${workspaceFolder}/.conf/id_rsa", - "-o", - "UserKnownHostsFile=/dev/null", - "-o", - "StrictHostKeyChecking=no", - "-P", - "${config:torizon_debug_ssh_port}", - "-pr", - "${workspaceFolder}/dist", - "${config:torizon_run_as}@${config:torizon_ip}:~/app" - ], - "dependsOrder": "sequence", - "problemMatcher": "$msCompile", - "icon": { - "id": "flame", - "color": "terminal.ansiYellow" - } - }, - { - "label": "deploy-assets", - "detail": "", - "hide": true, - "command": "scp", - "type": "process", - "args": [ - "-i", - "${workspaceFolder}/.conf/id_rsa", - "-o", - "UserKnownHostsFile=/dev/null", - "-o", - "StrictHostKeyChecking=no", - "-P", - "${config:torizon_debug_ssh_port}", - "-pr", - "${workspaceFolder}/assets", - "${config:torizon_run_as}@${config:torizon_ip}:~/app/assets" - ], - "dependsOrder": "sequence", - "problemMatcher": "$msCompile", - "icon": { - "id": "flame", - "color": "terminal.ansiYellow" - } - }, - { - "label": "deploy-libs", - "detail": "", - "hide": true, - "command": "scp", - "type": "process", - "args": [ - "-i", - "${workspaceFolder}/.conf/id_rsa", - "-o", - "UserKnownHostsFile=/dev/null", - "-o", - "StrictHostKeyChecking=no", - "-P", - "${config:torizon_debug_ssh_port}", - "-pr", - "${workspaceFolder}/libs", - "${config:torizon_run_as}@${config:torizon_ip}:~/app/libs" - ], - "dependsOrder": "sequence", - "problemMatcher": "$msCompile", - "icon": { - "id": "flame", - "color": "terminal.ansiYellow" - } - }, { "label": "exterminate-debugger", "detail": "", @@ -245,7 +167,7 @@ "-o", "StrictHostKeyChecking=no", "${config:torizon_run_as}@${config:torizon_ip}", - "java -agentlib:jdwp=transport=dt_socket,server=y,address=0.0.0.0:${config:torizon_debug_port},suspend=n -cp ${config:torizon_app_root}/app/libs/*:${config:torizon_app_root}/app/__change__.jar __change__.Form1 || true" + "java -agentlib:jdwp=transport=dt_socket,server=y,address=0.0.0.0:${config:torizon_debug_port},suspend=n -cp ${config:torizon_app_root}/libs/*:${config:torizon_app_root}/__change__.jar __change__.Form1 || true" ], "dependsOn": [ "validate-settings", @@ -259,10 +181,6 @@ "pull-container-torizon-debug-amd64", "run-container-torizon-debug-amd64", "wait-a-bit", - "pos-cleanup", - "deploy-application", - "deploy-assets", - "deploy-libs" ], "dependsOrder": "sequence", "problemMatcher": [ @@ -329,7 +247,7 @@ "-o", "StrictHostKeyChecking=no", "${config:torizon_run_as}@${config:torizon_ip}", - "java -agentlib:jdwp=transport=dt_socket,server=y,address=0.0.0.0:${config:torizon_debug_port},suspend=n -cp ${config:torizon_app_root}/app/libs/*:${config:torizon_app_root}/app/__change__.jar __change__.Form1 || true" + "java -agentlib:jdwp=transport=dt_socket,server=y,address=0.0.0.0:${config:torizon_debug_port},suspend=n -cp ${config:torizon_app_root}/libs/*:${config:torizon_app_root}/__change__.jar __change__.Form1 || true" ], "dependsOn": [ "validate-settings", @@ -343,10 +261,6 @@ "pull-container-torizon-debug-arm64", "run-container-torizon-debug-arm64", "wait-a-bit", - "pos-cleanup", - "deploy-application", - "deploy-assets", - "deploy-libs" ], "dependsOrder": "sequence", "problemMatcher": [ @@ -413,7 +327,7 @@ "-o", "StrictHostKeyChecking=no", "${config:torizon_run_as}@${config:torizon_ip}", - "java -agentlib:jdwp=transport=dt_socket,server=y,address=0.0.0.0:${config:torizon_debug_port},suspend=n -cp ${config:torizon_app_root}/app/libs/*:${config:torizon_app_root}/app/__change__.jar __change__.Form1 || true" + "java -agentlib:jdwp=transport=dt_socket,server=y,address=0.0.0.0:${config:torizon_debug_port},suspend=n -cp ${config:torizon_app_root}/libs/*:${config:torizon_app_root}/__change__.jar __change__.Form1 || true" ], "dependsOn": [ "validate-settings", @@ -427,10 +341,6 @@ "pull-container-torizon-debug-arm", "run-container-torizon-debug-arm", "wait-a-bit", - "pos-cleanup", - "deploy-application", - "deploy-assets", - "deploy-libs" ], "dependsOrder": "sequence", "problemMatcher": [ diff --git a/javaForms/Dockerfile b/javaForms/Dockerfile index 5d7814ae9..9517a68c8 100644 --- a/javaForms/Dockerfile +++ b/javaForms/Dockerfile @@ -5,13 +5,12 @@ ARG BASE_VERSION=4-rc ## -# Application Name +# Directory of the application inside container ## -ARG APP_EXECUTABLE=__change__ +ARG APP_ROOT= ## # Board architecture -# arm or arm64 ## ARG IMAGE_ARCH= @@ -25,6 +24,7 @@ FROM --platform=linux/${IMAGE_ARCH} \ ARG IMAGE_ARCH ARG GPU +ARG APP_ROOT # stick to bookworm on /etc/apt/sources.list.d RUN sed -i 's/sid/bookworm/g' /etc/apt/sources.list.d/debian.sources @@ -49,8 +49,8 @@ RUN apt-get -q -y update && \ rm -rf /var/lib/apt/lists/* # __deps__ -COPY . /app -WORKDIR /app +COPY . ${APP_ROOT} +WORKDIR ${APP_ROOT} RUN ant jar @@ -59,7 +59,7 @@ FROM --platform=linux/${IMAGE_ARCH} \ ARG IMAGE_ARCH ARG GPU -ARG APP_EXECUTABLE +ARG APP_ROOT # SSH for remote debug EXPOSE 2231 @@ -112,9 +112,19 @@ RUN apt-get -q -y update && \ apt-get clean && apt-get autoremove && \ rm -rf /var/lib/apt/lists/* -COPY libs /app/libs + USER torizon -WORKDIR /app -COPY --from=Build /app /app +COPY ./libs ${APP_ROOT}/libs +COPY ./assets ${APP_ROOT}/assets + +# Copy the application compiled in the build step to the $APP_ROOT directory +# path inside the container, where $APP_ROOT is the torizon_app_root +# configuration defined in settings.json +COPY --from=Build ${APP_ROOT} ${APP_ROOT} + +# "cd" (enter) into the APP_ROOT directory +WORKDIR ${APP_ROOT} + +# Command executed in runtime when the container starts CMD [ "java", "-cp","libs/*:dist/__change__.jar", "__change__.Form1" ] diff --git a/javaForms/Dockerfile.debug b/javaForms/Dockerfile.debug index a5d7717d5..c69ff4eaf 100644 --- a/javaForms/Dockerfile.debug +++ b/javaForms/Dockerfile.debug @@ -10,9 +10,9 @@ ARG IMAGE_ARCH= ARG BASE_VERSION=4-rc ## -# Application Name +# Directory of the application inside container ## -ARG APP_EXECUTABLE=__change__ +ARG APP_ROOT= ## # Debug port @@ -39,9 +39,8 @@ FROM --platform=linux/${IMAGE_ARCH} \ ARG IMAGE_ARCH ARG GPU ARG SSH_DEBUG_PORT -ARG APP_EXECUTABLE +ARG APP_ROOT ARG SSHUSERNAME -ENV APP_EXECUTABLE ${APP_EXECUTABLE} # SSH for remote debug EXPOSE ${SSH_DEBUG_PORT} @@ -127,4 +126,13 @@ RUN mkdir /var/run/sshd && \ RUN rm -r /etc/ssh/ssh*key && \ dpkg-reconfigure openssh-server + +COPY --chown=$SSHUSERNAME:$SSHUSERNAME ./assets ${APP_ROOT}/assets +COPY --chown=$SSHUSERNAME:$SSHUSERNAME ./libs ${APP_ROOT}/libs + +# Copy the compiled application to the $APP_ROOT directory path inside the +# container, where $APP_ROOT is the torizon_app_root configuration defined +# in settings.json. +COPY --chown=$SSHUSERNAME:$SSHUSERNAME ./dist ${APP_ROOT} + CMD [ "/usr/sbin/sshd", "-D" ] From 42f8278199020628ab19cac519db75ce83bfd426 Mon Sep 17 00:00:00 2001 From: Andre Riesco Date: Fri, 2 Feb 2024 15:22:56 -0300 Subject: [PATCH 08/10] gambasForms: Update the SSH copy to COPY inside the container Signed-off-by: Andre Riesco --- gambasForms/.vscode/settings.json | 2 +- gambasForms/Dockerfile | 27 ++++++++++++++++----------- gambasForms/Dockerfile.debug | 7 +++---- 3 files changed, 20 insertions(+), 16 deletions(-) diff --git a/gambasForms/.vscode/settings.json b/gambasForms/.vscode/settings.json index 1119a5d55..6432a3cee 100644 --- a/gambasForms/.vscode/settings.json +++ b/gambasForms/.vscode/settings.json @@ -17,7 +17,7 @@ }, "wait_sync": "1", "torizon_run_as": "torizon", - "torizon_app_root": "/home/torizon", + "torizon_app_root": "/home/torizon/app", "tcb.packageName": "__change__", "tcb.version": "3.8.1", "torizon.gpuPrefixRC": true diff --git a/gambasForms/Dockerfile b/gambasForms/Dockerfile index bf19cbe8f..d767729f1 100644 --- a/gambasForms/Dockerfile +++ b/gambasForms/Dockerfile @@ -10,9 +10,9 @@ ARG IMAGE_ARCH= ARG BASE_VERSION=3.17.90-4-rc ## -# Application Name +# Directory of the application inside container ## -ARG APP_EXECUTABLE=__change__ +ARG APP_ROOT= ## # Board GPU vendor prefix @@ -27,7 +27,7 @@ FROM --platform=linux/${IMAGE_ARCH} \ commontorizon/gambas3${GPU}:${BASE_VERSION} AS Build ARG IMAGE_ARCH -ARG APP_EXECUTABLE +ARG APP_ROOT COPY __change__ /build WORKDIR /build @@ -53,8 +53,7 @@ FROM --platform=linux/${IMAGE_ARCH} \ ARG IMAGE_ARCH ARG GPU -ARG APP_EXECUTABLE -ENV APP_EXECUTABLE ${APP_EXECUTABLE} +ARG APP_ROOT RUN apt-get -y update && apt-get install -y --no-install-recommends \ # ADD YOUR PACKAGES HERE @@ -64,12 +63,18 @@ RUN apt-get -y update && apt-get install -y --no-install-recommends \ # DO NOT REMOVE THIS LABEL: this is used for VS Code automation && apt-get clean && apt-get autoremove && rm -rf /var/lib/apt/lists/* -# copy the build -COPY --from=Build /build/__change__/__change__.gambas /app -# coyp the assets -COPY __change__/assets /app/assets +# copy the assets +COPY __change__/assets ${APP_ROOT}/assets -# ADD YOUR ARGUMENTS HERE -CMD [ "./app/__change__.gambas" ] +# Copy the application compiled in the build step to the $APP_ROOT directory +# path inside the container, where $APP_ROOT is the torizon_app_root +# configuration defined in settings.json +COPY --from=Build /build/__change__/__change__.gambas ${APP_ROOT} + +# "cd" (enter) into the APP_ROOT directory +WORKDIR ${APP_ROOT} + +# Command executed in runtime when the container starts +CMD [ "./__change__.gambas" ] # DEPLOY ----------------------------------------------------------------------- diff --git a/gambasForms/Dockerfile.debug b/gambasForms/Dockerfile.debug index b21fe561d..f9e5ef2b3 100644 --- a/gambasForms/Dockerfile.debug +++ b/gambasForms/Dockerfile.debug @@ -12,9 +12,9 @@ ARG IMAGE_ARCH= ARG BASE_VERSION=3.17.90-4-rc ## -# Application Name +# Directory of the application inside container ## -ARG APP_EXECUTABLE=__change__ +ARG APP_ROOT= ## # Debug port @@ -42,9 +42,8 @@ FROM --platform=linux/${IMAGE_ARCH} \ ARG IMAGE_ARCH ARG GPU ARG SSH_DEBUG_PORT -ARG APP_EXECUTABLE +ARG APP_ROOT ARG SSHUSERNAME -ENV APP_EXECUTABLE ${APP_EXECUTABLE} # SSH for remote debug EXPOSE ${SSH_DEBUG_PORT} From 022e0e91e3ae468f901a8299523b4d5e0387149d Mon Sep 17 00:00:00 2001 From: Andre Riesco Date: Mon, 5 Feb 2024 15:26:01 -0300 Subject: [PATCH 09/10] genericTemplate: Update the SSH copy to COPY inside the container Signed-off-by: Andre Riesco --- empty/.vscode/settings.json | 2 +- genericTemplate/.vscode/settings.json | 2 +- genericTemplate/Dockerfile | 7 +++++++ scripts/updateSettingsFields.ps1 | 2 +- 4 files changed, 10 insertions(+), 3 deletions(-) diff --git a/empty/.vscode/settings.json b/empty/.vscode/settings.json index a5a2bde31..0e9062f12 100644 --- a/empty/.vscode/settings.json +++ b/empty/.vscode/settings.json @@ -12,7 +12,7 @@ "torizon_arch": "", "wait_sync": "1", "torizon_run_as": "torizon", - "torizon_app_root": "/home/torizon", + "torizon_app_root": "/home/torizon/app", "tcb.packageName": "__change__", "tcb.version": "3.8.1" } diff --git a/genericTemplate/.vscode/settings.json b/genericTemplate/.vscode/settings.json index d40503807..510ed86a9 100644 --- a/genericTemplate/.vscode/settings.json +++ b/genericTemplate/.vscode/settings.json @@ -13,7 +13,7 @@ "torizon_arch": "", "wait_sync": "1", "torizon_run_as": "torizon", - "torizon_app_root": "/home/torizon", + "torizon_app_root": "/home/torizon/app", "tcb.packageName": "__change__", "tcb.version": "3.8.1" } diff --git a/genericTemplate/Dockerfile b/genericTemplate/Dockerfile index 7844f7daf..9c1fedba2 100644 --- a/genericTemplate/Dockerfile +++ b/genericTemplate/Dockerfile @@ -11,6 +11,11 @@ ARG IMAGE_ARCH= ## ARG GPU= +## +# Directory of the application inside container +## +ARG APP_ROOT= + # DEPLOY ------------------------------------------------------------------------ FROM --platform=linux/${IMAGE_ARCH} torizon/debian:${BASE_VERSION} @@ -24,6 +29,8 @@ RUN apt-get -y update && apt-get install -y --no-install-recommends \ # DO NOT REMOVE THIS LABEL: this is used for VS Code automation && apt-get clean && apt-get autoremove && rm -rf /var/lib/apt/lists/* +# "cd" (enter) into the APP_ROOT directory +WORKDIR ${APP_ROOT} # Command executed when starting the container CMD [ "echo", "Generic", "Dockerfile", "Template", "successfully", "executed" ] diff --git a/scripts/updateSettingsFields.ps1 b/scripts/updateSettingsFields.ps1 index c48f4be65..b889a2555 100644 --- a/scripts/updateSettingsFields.ps1 +++ b/scripts/updateSettingsFields.ps1 @@ -21,7 +21,7 @@ $settingsTemplate = [PSCustomObject]@{ torizon_login = "" torizon_ip = "" torizon_run_as = "torizon" - torizon_app_root = "/home/torizon" + torizon_app_root = "/home/torizon/app" torizon_debug_port = "" torizon_debug_port2 = "" torizon_debug_port3 = "" From 3dd513c31d97d82970fc076e5852544126b40c9c Mon Sep 17 00:00:00 2001 From: Andre Riesco Date: Tue, 6 Feb 2024 18:05:42 -0300 Subject: [PATCH 10/10] python3: Map the workspace to the contianer (not just /src directory) Just on the python3 ones this was different. Now correcting it. Signed-off-by: Andre Riesco --- python3Console/.vscode/launch.json | 8 ++++---- python3Pyside2QML/.vscode/launch.json | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/python3Console/.vscode/launch.json b/python3Console/.vscode/launch.json index 5a85dee74..235e942e7 100644 --- a/python3Console/.vscode/launch.json +++ b/python3Console/.vscode/launch.json @@ -17,8 +17,8 @@ "port": "${config:torizon_debug_port}", "pathMappings": [ { - "localRoot": "${workspaceFolder}/src", - "remoteRoot": "${config:torizon_app_root}/src" + "localRoot": "${workspaceFolder}", + "remoteRoot": "${config:torizon_app_root}" } ], "preLaunchTask": "wait-debugpy-start-arm" @@ -32,8 +32,8 @@ "port": "${config:torizon_debug_port}", "pathMappings": [ { - "localRoot": "${workspaceFolder}/src", - "remoteRoot": "${config:torizon_app_root}/src" + "localRoot": "${workspaceFolder}", + "remoteRoot": "${config:torizon_app_root}" } ], "preLaunchTask": "wait-debugpy-start-arm64" diff --git a/python3Pyside2QML/.vscode/launch.json b/python3Pyside2QML/.vscode/launch.json index 5a85dee74..235e942e7 100644 --- a/python3Pyside2QML/.vscode/launch.json +++ b/python3Pyside2QML/.vscode/launch.json @@ -17,8 +17,8 @@ "port": "${config:torizon_debug_port}", "pathMappings": [ { - "localRoot": "${workspaceFolder}/src", - "remoteRoot": "${config:torizon_app_root}/src" + "localRoot": "${workspaceFolder}", + "remoteRoot": "${config:torizon_app_root}" } ], "preLaunchTask": "wait-debugpy-start-arm" @@ -32,8 +32,8 @@ "port": "${config:torizon_debug_port}", "pathMappings": [ { - "localRoot": "${workspaceFolder}/src", - "remoteRoot": "${config:torizon_app_root}/src" + "localRoot": "${workspaceFolder}", + "remoteRoot": "${config:torizon_app_root}" } ], "preLaunchTask": "wait-debugpy-start-arm64"