Update with latest definition
This commit is contained in:
		@@ -1,83 +1,77 @@
 | 
			
		||||
#-------------------------------------------------------------------------------------------------------------
 | 
			
		||||
# Copyright (c) Microsoft Corporation. All rights reserved.
 | 
			
		||||
# Licensed under the MIT License. See https://go.microsoft.com/fwlink/?linkid=2090316 for license information.
 | 
			
		||||
#-------------------------------------------------------------------------------------------------------------
 | 
			
		||||
# Update the VARIANT arg in devcontainer.json to pick an Go version
 | 
			
		||||
ARG VARIANT=1
 | 
			
		||||
FROM golang:${VARIANT}
 | 
			
		||||
 | 
			
		||||
FROM golang:1
 | 
			
		||||
 | 
			
		||||
# Avoid warnings by switching to noninteractive
 | 
			
		||||
ENV DEBIAN_FRONTEND=noninteractive
 | 
			
		||||
 | 
			
		||||
# This Dockerfile adds a non-root user with sudo access. Use the "remoteUser"
 | 
			
		||||
# property in devcontainer.json to use it. On Linux, the container user's GID/UIDs
 | 
			
		||||
# will be updated to match your local UID/GID (when using the dockerFile property).
 | 
			
		||||
# See https://aka.ms/vscode-remote/containers/non-root-user for details.
 | 
			
		||||
# This Dockerfile adds a non-root user with sudo access. Update the “remoteUser” property in
 | 
			
		||||
# devcontainer.json to use it. More info: https://aka.ms/vscode-remote/containers/non-root-user.
 | 
			
		||||
ARG USERNAME=vscode
 | 
			
		||||
ARG USER_UID=1000
 | 
			
		||||
ARG USER_GID=$USER_UID
 | 
			
		||||
 | 
			
		||||
# Configure apt, install packages and tools
 | 
			
		||||
# Options for common setup script - SHA generated on release
 | 
			
		||||
ARG INSTALL_ZSH="true"
 | 
			
		||||
ARG UPGRADE_PACKAGES="false"
 | 
			
		||||
ARG COMMON_SCRIPT_SOURCE="https://raw.githubusercontent.com/microsoft/vscode-dev-containers/master/script-library/common-debian.sh"
 | 
			
		||||
ARG COMMON_SCRIPT_SHA="dev-mode"
 | 
			
		||||
 | 
			
		||||
# Install needed packages and setup non-root user. Use a separate RUN statement to add your own dependencies.
 | 
			
		||||
RUN apt-get update \
 | 
			
		||||
    && apt-get -y install --no-install-recommends apt-utils dialog 2>&1 \
 | 
			
		||||
    #
 | 
			
		||||
    # Verify git, process tools, lsb-release (common in install instructions for CLIs) installed
 | 
			
		||||
    && apt-get -y install git openssh-client less iproute2 procps lsb-release \
 | 
			
		||||
    #
 | 
			
		||||
    # Build Go tools w/module support
 | 
			
		||||
    && mkdir -p /tmp/gotools \
 | 
			
		||||
    && cd /tmp/gotools \
 | 
			
		||||
    && GOPATH=/tmp/gotools GO111MODULE=on go get -v golang.org/x/tools/gopls@latest 2>&1 \
 | 
			
		||||
    && GOPATH=/tmp/gotools GO111MODULE=on go get -v \
 | 
			
		||||
        honnef.co/go/tools/...@latest \
 | 
			
		||||
        golang.org/x/tools/cmd/gorename@latest \
 | 
			
		||||
        golang.org/x/tools/cmd/goimports@latest \
 | 
			
		||||
        golang.org/x/tools/cmd/guru@latest \
 | 
			
		||||
        golang.org/x/lint/golint@latest \
 | 
			
		||||
        github.com/mdempsky/gocode@latest \
 | 
			
		||||
        github.com/cweill/gotests/...@latest \
 | 
			
		||||
        github.com/haya14busa/goplay/cmd/goplay@latest \
 | 
			
		||||
        github.com/sqs/goreturns@latest \
 | 
			
		||||
        github.com/josharian/impl@latest \
 | 
			
		||||
        github.com/davidrjenni/reftools/cmd/fillstruct@latest \
 | 
			
		||||
        github.com/uudashr/gopkgs/v2/cmd/gopkgs@latest  \
 | 
			
		||||
        github.com/ramya-rao-a/go-outline@latest  \
 | 
			
		||||
        github.com/acroca/go-symbols@latest  \
 | 
			
		||||
        github.com/godoctor/godoctor@latest  \
 | 
			
		||||
        github.com/rogpeppe/godef@latest  \
 | 
			
		||||
        github.com/zmb3/gogetdoc@latest \
 | 
			
		||||
        github.com/fatih/gomodifytags@latest  \
 | 
			
		||||
        github.com/mgechev/revive@latest  \
 | 
			
		||||
        github.com/go-delve/delve/cmd/dlv@latest 2>&1 \
 | 
			
		||||
    #
 | 
			
		||||
    # Build Go tools w/o module support
 | 
			
		||||
    && GOPATH=/tmp/gotools go get -v github.com/alecthomas/gometalinter 2>&1 \
 | 
			
		||||
    #
 | 
			
		||||
    # Build gocode-gomod
 | 
			
		||||
    && GOPATH=/tmp/gotools go get -x -d github.com/stamblerre/gocode 2>&1 \
 | 
			
		||||
    && GOPATH=/tmp/gotools go build -o gocode-gomod github.com/stamblerre/gocode \
 | 
			
		||||
    #
 | 
			
		||||
    # Install Go tools
 | 
			
		||||
    && mv /tmp/gotools/bin/* /usr/local/bin/ \
 | 
			
		||||
    && mv gocode-gomod /usr/local/bin/ \
 | 
			
		||||
    #
 | 
			
		||||
    # Install golangci-lint
 | 
			
		||||
    && curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b /usr/local/bin 2>&1 \
 | 
			
		||||
    #
 | 
			
		||||
    # Create a non-root user to use if preferred - see https://aka.ms/vscode-remote/containers/non-root-user.
 | 
			
		||||
    && groupadd --gid $USER_GID $USERNAME \
 | 
			
		||||
    && useradd -s /bin/bash --uid $USER_UID --gid $USER_GID -m $USERNAME \
 | 
			
		||||
    # [Optional] Add sudo support
 | 
			
		||||
    && apt-get install -y sudo \
 | 
			
		||||
    && echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \
 | 
			
		||||
    && chmod 0440 /etc/sudoers.d/$USERNAME \
 | 
			
		||||
    #
 | 
			
		||||
    && export DEBIAN_FRONTEND=noninteractive \
 | 
			
		||||
    && apt-get -y install --no-install-recommends curl ca-certificates 2>&1 \
 | 
			
		||||
    && curl -sSL  ${COMMON_SCRIPT_SOURCE} -o /tmp/common-setup.sh \
 | 
			
		||||
    && ([ "${COMMON_SCRIPT_SHA}" = "dev-mode" ] || (echo "${COMMON_SCRIPT_SHA} /tmp/common-setup.sh" | sha256sum -c -)) \
 | 
			
		||||
    && /bin/bash /tmp/common-setup.sh "${INSTALL_ZSH}" "${USERNAME}" "${USER_UID}" "${USER_GID}" "${UPGRADE_PACKAGES}" \
 | 
			
		||||
    # Clean up
 | 
			
		||||
    && apt-get autoremove -y \
 | 
			
		||||
    && apt-get clean -y \
 | 
			
		||||
    && rm -rf /var/lib/apt/lists/* /tmp/gotools
 | 
			
		||||
    && rm -rf /var/lib/apt/lists/*
 | 
			
		||||
 | 
			
		||||
# Install Go tools
 | 
			
		||||
ARG GO_TOOLS_WITH_MODULES="\
 | 
			
		||||
    golang.org/x/tools/gopls \
 | 
			
		||||
    honnef.co/go/tools/... \
 | 
			
		||||
    golang.org/x/tools/cmd/gorename \
 | 
			
		||||
    golang.org/x/tools/cmd/goimports \
 | 
			
		||||
    golang.org/x/tools/cmd/guru \
 | 
			
		||||
    golang.org/x/lint/golint \
 | 
			
		||||
    github.com/mdempsky/gocode \
 | 
			
		||||
    github.com/cweill/gotests/... \
 | 
			
		||||
    github.com/haya14busa/goplay/cmd/goplay \
 | 
			
		||||
    github.com/sqs/goreturns \
 | 
			
		||||
    github.com/josharian/impl \
 | 
			
		||||
    github.com/davidrjenni/reftools/cmd/fillstruct \
 | 
			
		||||
    github.com/uudashr/gopkgs/v2/cmd/gopkgs \
 | 
			
		||||
    github.com/ramya-rao-a/go-outline \
 | 
			
		||||
    github.com/acroca/go-symbols \
 | 
			
		||||
    github.com/godoctor/godoctor \
 | 
			
		||||
    github.com/rogpeppe/godef \
 | 
			
		||||
    github.com/zmb3/gogetdoc \
 | 
			
		||||
    github.com/fatih/gomodifytags \
 | 
			
		||||
    github.com/mgechev/revive \
 | 
			
		||||
    github.com/go-delve/delve/cmd/dlv"
 | 
			
		||||
RUN mkdir -p /tmp/gotools \
 | 
			
		||||
    && cd /tmp/gotools \
 | 
			
		||||
    && export GOPATH=/tmp/gotools \
 | 
			
		||||
    # Go tools w/module support
 | 
			
		||||
    && export GO111MODULE=on \
 | 
			
		||||
    && (echo "${GO_TOOLS_WITH_MODULES}" | xargs -n 1 go get -x )2>&1 \
 | 
			
		||||
    # gocode-gomod
 | 
			
		||||
    && export GO111MODULE=auto \
 | 
			
		||||
    && go get -x -d github.com/stamblerre/gocode 2>&1 \
 | 
			
		||||
    && go build -o gocode-gomod github.com/stamblerre/gocode \
 | 
			
		||||
    # golangci-lint
 | 
			
		||||
    && curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b /usr/local/bin 2>&1 \
 | 
			
		||||
    # Move Go tools into path and clean up
 | 
			
		||||
    && mv /tmp/gotools/bin/* /usr/local/bin/ \
 | 
			
		||||
    && mv gocode-gomod /usr/local/bin/ \
 | 
			
		||||
    && rm -rf /tmp/gotools
 | 
			
		||||
 | 
			
		||||
# Update this to "on" or "off" as appropriate
 | 
			
		||||
ENV GO111MODULE=auto
 | 
			
		||||
 | 
			
		||||
# Switch back to dialog for any ad-hoc use of apt-get
 | 
			
		||||
ENV DEBIAN_FRONTEND=dialog
 | 
			
		||||
# [Optional] Uncomment the next line to use go get to install anything else you need
 | 
			
		||||
# RUN go get -x <your-dependency-or-tool>
 | 
			
		||||
 | 
			
		||||
# [Optional] Uncomment this section to install additional OS packages.
 | 
			
		||||
# RUN apt-get update \
 | 
			
		||||
#     && export DEBIAN_FRONTEND=noninteractive \
 | 
			
		||||
#     && apt-get -y install --no-install-recommends <your-package-list-here>
 | 
			
		||||
@@ -1,28 +1,31 @@
 | 
			
		||||
{
 | 
			
		||||
	"name": "Go Sample",
 | 
			
		||||
	"dockerFile": "Dockerfile",
 | 
			
		||||
	"name": "Go",
 | 
			
		||||
	"build": {
 | 
			
		||||
		"dockerfile": "Dockerfile",
 | 
			
		||||
		// Update the VARIANT arg to pick a version of Go
 | 
			
		||||
		"args": { "VARIANT": "1" }
 | 
			
		||||
	},
 | 
			
		||||
	"runArgs": [ "--cap-add=SYS_PTRACE", "--security-opt", "seccomp=unconfined" ],
 | 
			
		||||
 | 
			
		||||
	// Use 'forwardPorts' to make a list of ports inside the container available locally.
 | 
			
		||||
	"forwardPorts": [9000],
 | 
			
		||||
 | 
			
		||||
	// Use 'settings' to set *default* container specific settings.json values on container create. 
 | 
			
		||||
	// You can edit these settings after create using File > Preferences > Settings > Remote.
 | 
			
		||||
	// Set *default* container specific settings.json values on container create.
 | 
			
		||||
	"settings": { 
 | 
			
		||||
		"terminal.integrated.shell.linux": "/bin/bash",
 | 
			
		||||
		"go.gopath": "/go",
 | 
			
		||||
		"go.inferGopath": true,
 | 
			
		||||
		"go.useLanguageServer": true
 | 
			
		||||
	},
 | 
			
		||||
 | 
			
		||||
	// Add the IDs of extensions you want installed when the container is created in the array below.
 | 
			
		||||
	
 | 
			
		||||
	// Add the IDs of extensions you want installed when the container is created.
 | 
			
		||||
	"extensions": [
 | 
			
		||||
		"golang.Go"
 | 
			
		||||
	],
 | 
			
		||||
	
 | 
			
		||||
	// Uncomment the next line to run commands after the container is created.
 | 
			
		||||
 | 
			
		||||
	// Use 'forwardPorts' to make a list of ports inside the container available locally.
 | 
			
		||||
	"forwardPorts": [9000],
 | 
			
		||||
 | 
			
		||||
	// Use 'postCreateCommand' to run commands after the container is created.
 | 
			
		||||
	// "postCreateCommand": "go version",
 | 
			
		||||
 | 
			
		||||
	// Comment out the next line to run as root
 | 
			
		||||
	// Uncomment to connect as a non-root user. See https://aka.ms/vscode-remote/containers/non-root.
 | 
			
		||||
	"remoteUser": "vscode"
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user