From fba490969d74fac72aa48a4b461d3c349f995127 Mon Sep 17 00:00:00 2001 From: Ocraftyone Date: Sat, 27 Jan 2024 01:16:30 -0500 Subject: [PATCH] Add Devcontainer Support (#3777) * add devcontainer files * update postCreate * add chmod for postCreate * set CORES env variable to pass to build tool * remove ssh functionality * Move delete env file cmd to postStartCommand * update how env file is done * Update - Move to older version of ubuntu for compatability - Change vnc password to orca --- .devcontainer/devcontainer.json | 51 +++++++++++++++++++++++++++++++++ .devcontainer/postCreate.sh | 14 +++++++++ 2 files changed, 65 insertions(+) create mode 100644 .devcontainer/devcontainer.json create mode 100755 .devcontainer/postCreate.sh diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 000000000..413866a66 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,51 @@ +{ + "name": "OrcaSlicer", + "image": "mcr.microsoft.com/devcontainers/cpp:ubuntu-20.04", + "runArgs": ["--env-file", "/tmp/devcontainer.env"], + "features": { + "ghcr.io/devcontainers/features/desktop-lite:1": { + "password": "orca" + } + }, + "customizations": { + "vscode": { + "settings": { + "cmake.configureArgs": [ + "-DSLIC3R_GTK=3", + "-DBBL_RELEASE_TO_PUBLIC=1", + "-DBBL_INTERNAL_TESTING=0", + "-DSLIC3R_STATIC=1", + "-DCMAKE_PREFIX_PATH=${workspaceFolder}/deps/build/destdir/usr/local" + ], + "cmake.buildToolArgs": [ + "-l${containerEnv:CORES}" + ] + }, + + // Add the IDs of extensions you want installed when the container is created. + "extensions": [ + "ms-vscode.cmake-tools", + "ms-vscode.cpptools-extension-pack" + ] + } + }, + + "forwardPorts": [6080], + "portsAttributes": { + "6080": { + "label": "VNC web client (noVNC)", + "onAutoForward": "silent" + } + }, + "otherPortsAttributes": { + "onAutoForward": "ignore" + }, + + "initializeCommand": { + "Setup Temporary Env File": "echo \"CORES=`nproc --all`\" > /tmp/devcontainer.env" + }, + "onCreateCommand": { + "Set postCreate executable flag": "chmod +x .devcontainer/postCreate.sh" + }, + "postCreateCommand": "sudo .devcontainer/postCreate.sh" +} \ No newline at end of file diff --git a/.devcontainer/postCreate.sh b/.devcontainer/postCreate.sh new file mode 100755 index 000000000..ea76f8e22 --- /dev/null +++ b/.devcontainer/postCreate.sh @@ -0,0 +1,14 @@ +#!/bin/bash +# Update and upgrade all system packages +apt update +apt upgrade -y + +echo "-----------------------------------------" +echo "Running BuildLinux.sh with update flag..." +echo "-----------------------------------------" +./BuildLinux.sh -u + +echo "------------------------------" +echo "Installing missing packages..." +echo "------------------------------" +apt install -y libgl1-mesa-dev m4 autoconf libtool \ No newline at end of file