devcontainer: Update Dockerfile and settings for VSCode (#2020)

* devcontainer: Update Dockerfile and configuration for GoCryptoTrader setup

* devcontainer: Update comment for clarity on format and config details

* devcontainer: Refactor post-create command to use dedicated script for tool installation

* devcontainer: Update comment for Go modernise tool for clarity
This commit is contained in:
Adrian Gallagher
2025-09-01 09:24:25 +10:00
committed by GitHub
parent d5b2cf1759
commit e98b9561ec
4 changed files with 85 additions and 30 deletions

View File

@@ -1,17 +1,30 @@
# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.195.0/containers/go/.devcontainer/base.Dockerfile
# [Choice] Go version (use -bullseye variants on local arm64/Apple Silicon): 1, 1.16, 1.17, 1-bullseye, 1.16-bullseye, 1.17-bullseye, 1-buster, 1.16-buster, 1.17-buster
ARG VARIANT=1-bullseye
FROM mcr.microsoft.com/vscode/devcontainers/go:0-${VARIANT}
## Dev Container base image
# See: https://github.com/devcontainers/images/tree/main/src/go
# Use the published "dev-" tagged image for the latest Go version.
# See MCR tags: dev-1.25, dev-1.25-bookworm
ARG VARIANT=dev-1.25-bookworm
FROM mcr.microsoft.com/devcontainers/go:${VARIANT}
# [Choice] Node.js version: lts/*, 16, 14, 12, 10
ARG NODE_VERSION="lts/*"
RUN if [ "${NODE_VERSION}" != "none" ]; then su vscode -c ". /usr/local/share/nvm/nvm.sh && nvm install ${NODE_VERSION} 2>&1"; fi
USER root
RUN apt-get update \
&& export DEBIAN_FRONTEND=noninteractive \
&& apt-get install -y --no-install-recommends \
git \
make \
build-essential \
bash-completion \
ca-certificates \
curl \
unzip \
libssl-dev \
protobuf-compiler \
jq \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# RUN mv -vn config_example.json config.json
WORKDIR /workspace
# RUN cp . /workspace/
# RUN CWD
# RUN GO111MODULE=on go mod vendor
# RUN go build .
# RUN go build ./cmd/gctcli
RUN mkdir -p /home/vscode/.cache/go-build /go \
&& chown -R vscode:vscode /home/vscode/.cache /go
USER vscode