Skip to content

Instantly share code, notes, and snippets.

@engalar
Created March 18, 2026 03:15
Show Gist options
  • Select an option

  • Save engalar/8c5307031ff2d44199684ab6c2ddaed0 to your computer and use it in GitHub Desktop.

Select an option

Save engalar/8c5307031ff2d44199684ab6c2ddaed0 to your computer and use it in GitHub Desktop.
mendix mxcli devcontainer china mirror
{
"name": "Mendix Model SDK Go",
"image": "engalar/vsc-mxcli",
// 移除 host.docker.internal 相关配置,改用宿主机实际 IP
"containerEnv": {
// 方案A:用 Docker 网桥网关(通用)
"HTTP_PROXY": "http://192.168.2.35:29758",
"HTTPS_PROXY": "http://192.168.2.35:29758",
// 方案B:用宿主机真实 IP(推荐,更稳定)
// "HTTP_PROXY": "http://192.168.1.100:29758",
// "HTTPS_PROXY": "http://192.168.1.100:29758",
"NO_PROXY": "localhost,127.0.0.1,192.168.2.35,192.168.1.100"
},
"features": {},
"forwardPorts": [
8080,
8090,
5432
],
"portsAttributes": {
"8080-8099": {
"onAutoForward": "silent"
},
"5432-5499": {
"onAutoForward": "silent"
}
},
"customizations": {
"vscode": {
"extensions": [
"golang.go",
"ms-vscode.makefile-tools",
"anthropic.claude-code",
"mike-lischke.vscode-antlr4"
],
"settings": {
"go.toolsManagement.autoUpdate": true,
"go.useLanguageServer": true,
"go.lintTool": "golangci-lint",
"editor.formatOnSave": true,
"[go]": {
"editor.defaultFormatter": "golang.go"
}
}
}
},
"postCreateCommand": "curl -fsSL https://claude.ai/install.sh | bash && go mod download",
"remoteUser": "vscode",
"remoteEnv": {
"CGO_ENABLED": "1"
}
}
# Mendix Model SDK Go - Development Container
FROM mcr.microsoft.com/devcontainers/go:dev-1.26-bookworm
# Set USE_CHINA_MIRROR=true to use Chinese mirrors for faster downloads
ARG USE_CHINA_MIRROR=false
RUN rm -f /etc/apt/sources.list.d/yarn.list
# Configure Debian apt mirror (USTC) for China
RUN if [ "$USE_CHINA_MIRROR" = "true" ]; then \
sed -i 's|deb.debian.org|mirrors.ustc.edu.cn|g' /etc/apt/sources.list.d/debian.sources 2>/dev/null || \
sed -i 's|deb.debian.org|mirrors.ustc.edu.cn|g' /etc/apt/sources.list 2>/dev/null || true; \
fi
# Install Adoptium JDK 21 (required by MxBuild) and JDK 17 (required by ANTLR4)
RUN apt-get update && apt-get install -y --no-install-recommends \
wget apt-transport-https gpg \
python3-pip \
sqlite3 \
postgresql-client \
kafkacat \
&& wget -qO - https://packages.adoptium.net/artifactory/api/gpg/key/public | gpg --dearmor -o /etc/apt/keyrings/adoptium.gpg \
&& if [ "$USE_CHINA_MIRROR" = "true" ]; then \
echo "deb [signed-by=/etc/apt/keyrings/adoptium.gpg] https://mirrors.tuna.tsinghua.edu.cn/Adoptium/deb bookworm main" > /etc/apt/sources.list.d/adoptium.list; \
else \
echo "deb [signed-by=/etc/apt/keyrings/adoptium.gpg] https://packages.adoptium.net/artifactory/deb bookworm main" > /etc/apt/sources.list.d/adoptium.list; \
fi \
&& apt-get update \
&& apt-get install -y --no-install-recommends \
openjdk-17-jre-headless \
temurin-21-jdk \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# Install ANTLR4 tools (use Tsinghua PyPI mirror for China)
RUN if [ "$USE_CHINA_MIRROR" = "true" ]; then \
pip3 install --break-system-packages -i https://pypi.tuna.tsinghua.edu.cn/simple antlr4-tools; \
else \
pip3 install --break-system-packages antlr4-tools; \
fi
# Configure Go proxy for China
RUN if [ "$USE_CHINA_MIRROR" = "true" ]; then \
go env -w GOPROXY=https://goproxy.cn,direct; \
fi
# Install bun (required for VS Code extension builds)
# Install to /usr/local so all users (including vscode) can execute it
USER vscode
RUN if [ "$USE_CHINA_MIRROR" = "true" ]; then \
BUNJS_MIRROR=https://registry.npmmirror.com/-/binary/bun BUN_INSTALL=/usr/local curl -fsSL https://bun.sh/install | bash; \
else \
BUN_INSTALL=/usr/local curl -fsSL https://bun.sh/install | bash; \
fi
USER root
# Create libs directory for reflection data
RUN mkdir -p /workspaces/ModelSDKGo/libs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment