Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 24 additions & 15 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,28 @@
// 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
"image": "mcr.microsoft.com/devcontainers/go:dev-1-bullseye",
// 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": [
8181
],
// Use 'postCreateCommand' to run commands after the container is created.
"postCreateCommand": "go install github.com/air-verse/[email protected]"
// Configure tool-specific properties.
// "customizations": {},
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "root"
"name": "Go",
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
"image": "mcr.microsoft.com/devcontainers/go:1.25-trixie",
// 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": [
8181
],
"containerEnv": {
"HTTP_PROXY": "${localEnv:HTTP_PROXY:}",
"HTTPS_PROXY": "${localEnv:HTTPS_PROXY:}",
"NO_PROXY": "${localEnv:NO_PROXY:}",
"http_proxy": "${localEnv:http_proxy:}",
"https_proxy": "${localEnv:https_proxy:}",
"no_proxy": "${localEnv:no_proxy:}"
},
// Use 'postCreateCommand' to run commands after the container is created.
"postCreateCommand": "sed -i 's/\\r$//' .devcontainer/post-create.sh && /bin/bash .devcontainer/post-create.sh"

// Configure tool-specific properties.
// "customizations": {},
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "root"
}
31 changes: 31 additions & 0 deletions .devcontainer/post-create.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/bin/bash
set -e

# Unset empty proxy variables
for var in HTTP_PROXY HTTPS_PROXY NO_PROXY http_proxy https_proxy no_proxy; do
eval v="\${$var}"
if [ -z "$v" ]; then unset $var; fi
done

# Strip all trailing '/' or '\\' from proxy URLs for apt config
strip_trailing_slash() {
local url="$1"
# Remove all trailing / or \
url="${url%%*(/|\\)}"
# Fallback for Bash < 4.0 (no extglob): use sed
echo "$url" | sed 's%[\\/]*$%%'
}

if [ -n "$HTTP_PROXY" ] || [ -n "$http_proxy" ] || [ -n "$HTTPS_PROXY" ] || [ -n "$https_proxy" ]; then
echo "Configuring apt to use proxy..."
sudo mkdir -p /etc/apt/apt.conf.d
# Remove all trailing / or \\ from proxy URLs
apt_http_proxy="$(strip_trailing_slash "${HTTP_PROXY:-${http_proxy:-}}")"
apt_https_proxy="$(strip_trailing_slash "${HTTPS_PROXY:-${https_proxy:-}}")"
sudo tee /etc/apt/apt.conf.d/99proxy > /dev/null <<EOF
Acquire::http::Proxy "$apt_http_proxy";
Acquire::https::Proxy "$apt_https_proxy";
EOF
fi

go install github.com/air-verse/air@latest
18 changes: 13 additions & 5 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,24 @@

# Get version from the first argument
version=$1
# Set proxy environment variables only if they have values
[ -n "${HTTP_PROXY:-${http_proxy:-}}" ] && export HTTP_PROXY="${HTTP_PROXY:-${http_proxy:-}}"
[ -n "${HTTPS_PROXY:-${https_proxy:-}}" ] && export HTTPS_PROXY="${HTTPS_PROXY:-${https_proxy:-}}"
[ -n "${NO_PROXY:-${no_proxy:-}}" ] && export NO_PROXY="${NO_PROXY:-${no_proxy:-localhost,127.0.0.1}}"

# Build Docker images for each variant
# Full build (with UI)
docker build -t vprodemo.azurecr.io/console:v$version \
-t vprodemo.azurecr.io/console:latest .
docker build --build-arg HTTP_PROXY="$HTTP_PROXY" --build-arg HTTPS_PROXY="$HTTPS_PROXY" \
--build-arg NO_PROXY="$NO_PROXY" \
-t vprodemo.azurecr.io/console:v$version \
-t vprodemo.azurecr.io/console:latest .

# Headless build (No UI)
docker build --build-arg BUILD_TAGS="noui" \
-t vprodemo.azurecr.io/console:v$version-headless \
-t vprodemo.azurecr.io/console:latest-headless .
docker build --build-arg --build-arg HTTP_PROXY="$HTTP_PROXY" \
--build-arg HTTPS_PROXY="$HTTPS_PROXY" --build-arg NO_PROXY="$NO_PROXY" \
--build-arg BUILD_TAGS="noui" \
-t vprodemo.azurecr.io/console:v$version-headless \
-t vprodemo.azurecr.io/console:latest-headless .

# Mark the Unix system outputs as executable
chmod +x dist/linux/console_linux_x64
Expand Down
Loading