Skip to content

Commit 69dc51e

Browse files
committed
build: proxy settings for build and devcontainer
-> devcontainer go version updated to 1.25 -> devcontainer updated to include proxy settings -> build script support proxy build Signed-off-by: Nabendu Maiti <nabendu.bikash.maiti@intel.com>
1 parent 925197d commit 69dc51e

File tree

2 files changed

+28
-16
lines changed

2 files changed

+28
-16
lines changed

.devcontainer/devcontainer.json

Lines changed: 23 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,27 @@
11
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
22
// README at: https://github.com/devcontainers/templates/tree/main/src/go
33
{
4-
"name": "Go",
5-
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
6-
"image": "mcr.microsoft.com/devcontainers/go:dev-1-bullseye",
7-
// Features to add to the dev container. More info: https://containers.dev/features.
8-
// "features": {},
9-
// Use 'forwardPorts' to make a list of ports inside the container available locally.
10-
"forwardPorts": [
11-
8181
12-
],
13-
// Use 'postCreateCommand' to run commands after the container is created.
14-
"postCreateCommand": "go install github.com/air-verse/air@v1.62.0"
15-
// Configure tool-specific properties.
16-
// "customizations": {},
17-
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
18-
// "remoteUser": "root"
4+
"name": "Go",
5+
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
6+
"image": "mcr.microsoft.com/devcontainers/go:1.25-trixie",
7+
// Features to add to the dev container. More info: https://containers.dev/features.
8+
// "features": {},
9+
// Use 'forwardPorts' to make a list of ports inside the container available locally.
10+
"forwardPorts": [
11+
8181
12+
],
13+
"containerEnv": {
14+
"HTTP_PROXY": "${localEnv:HTTP_PROXY:}",
15+
"HTTPS_PROXY": "${localEnv:HTTPS_PROXY:}",
16+
"NO_PROXY": "${localEnv:NO_PROXY:}",
17+
"http_proxy": "${localEnv:http_proxy:}",
18+
"https_proxy": "${localEnv:https_proxy:}",
19+
"no_proxy": "${localEnv:no_proxy:}"
20+
},
21+
// Use 'postCreateCommand' to run commands after the container is created.
22+
"postCreateCommand": "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 && go install github.com/air-verse/air@latest"
23+
// Configure tool-specific properties.
24+
// "customizations": {},
25+
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
26+
// "remoteUser": "root"
1927
}

build.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,12 @@
22

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

6-
docker build -t vprodemo.azurecr.io/console:v$version .
10+
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 .
711

812
# Mark the Unix system outputs as executable
913
chmod +x dist/linux/console_linux_x64

0 commit comments

Comments
 (0)