From 6cc45bfbcc96381307172e49f59737b76bb67f49 Mon Sep 17 00:00:00 2001 From: Aviad Hahami Date: Mon, 19 Feb 2024 12:03:54 +0200 Subject: [PATCH] pr comments changes --- .devcontainer/devcontainer.json | 20 ++------------------ .devcontainer/postcreate.sh | 22 ++++++++++++++-------- Makefile | 1 + 3 files changed, 17 insertions(+), 26 deletions(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 0b8ab67..2ba857d 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,23 +1,7 @@ -// For format details, see https://aka.ms/devcontainer.json. For config options, see the -// README at: https://github.com/devcontainers/templates/tree/main/src/go { - "name": "Go", - // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile + "name": "slrp dev", "image": "mcr.microsoft.com/devcontainers/go:1-1.20-bookworm", - - // Features to add to the dev container. More info: https://containers.dev/features. - // "features": {}, - - // Use 'forwardPorts' to make a list of ports inside the container available locally. - // "forwardPorts": [], - - // Use 'postCreateCommand' to run commands after the container is created. "postCreateCommand": ".devcontainer/postcreate.sh", - - // Configure tool-specific properties. - // "customizations": {}, - - // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. "remoteUser": "root", "customizations": { "vscode": { @@ -30,4 +14,4 @@ ] } } -} +} \ No newline at end of file diff --git a/.devcontainer/postcreate.sh b/.devcontainer/postcreate.sh index 3934772..2ca6977 100755 --- a/.devcontainer/postcreate.sh +++ b/.devcontainer/postcreate.sh @@ -1,11 +1,17 @@ #!/bin/bash -echo "[ + ] Running post-create script..." -echo "[ + ] Installing Node.js 20..." +NVM_VERSION="0.38.0" +NODE_VERSION="20" + +echo "[ + ] Running post-create script. Installing the following:" +echo "[ + ] NVM version: $NVM_VERSION" +echo "[ + ] NodeJS version: $NODE_VERSION" +echo "[ + ] ==============================" # Check if we don't have nvm, if no - install it -echo "[ + ] Installing nvm..." -curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | bash +echo "[ + ] Installing nvm at v$NVM_VERSION" + +curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v$NVM_VERSION/install.sh | bash # Activate nvm export NVM_DIR="$HOME/.nvm" [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" @@ -13,13 +19,13 @@ export NVM_DIR="$HOME/.nvm" # Refresh bash source ~/.bashrc -# Install node 20 -echo "[ + ] Installing Node.js 20..." -nvm install 20 && nvm use 20; +# Install node at a set versions +echo "[ + ] Installing NodeJS at v$NODE_VERSION" +nvm install $NODE_VERSION && nvm use $NODE_VERSION echo "[ + ] Installing UI dependencies and building..." # Change to the "ui" directory cd ui && npm install && cd ../ echo "[ + ] Installing Go dependencies and building..." -make build \ No newline at end of file +make build diff --git a/Makefile b/Makefile index a21f345..6bd3dc8 100644 --- a/Makefile +++ b/Makefile @@ -20,6 +20,7 @@ build: build-ui go mod vendor go build -ldflags "-s -w" main.go +# When running inside Alpine images there are no classic OS packages/binaries enabled, hence - we compile statically (CGO) build-go-for-docker: go mod vendor CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -ldflags "-s -w" -o main main.go