Skip to content

Commit

Permalink
pr comments changes
Browse files Browse the repository at this point in the history
  • Loading branch information
aviadhahami committed Feb 25, 2024
1 parent 0a72c77 commit 6cc45bf
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 26 deletions.
20 changes: 2 additions & 18 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand All @@ -30,4 +14,4 @@
]
}
}
}
}
22 changes: 14 additions & 8 deletions .devcontainer/postcreate.sh
Original file line number Diff line number Diff line change
@@ -1,25 +1,31 @@
#!/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"

# 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
make build
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 6cc45bf

Please sign in to comment.