From eef352b5654ef71e384becf7937407d364d8e85e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Gronowski?= Date: Fri, 1 Mar 2024 14:51:18 +0100 Subject: [PATCH] devcontainer: Use a separate devcontainer target MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use a separate `devcontainer` Dockerfile target, this allows to include the `gopls` in the devcontainer so it doesn't have to be installed by the Go vscode extension. Signed-off-by: Paweł Gronowski --- .devcontainer/devcontainer.json | 2 +- Dockerfile | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 87e0aa4325..ff9d7c0bbc 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -3,7 +3,7 @@ "build": { "context": "..", "dockerfile": "../Dockerfile", - "target": "dev" + "target": "devcontainer" }, "workspaceFolder": "/go/src/github.com/docker/docker", "workspaceMount": "source=${localWorkspaceFolder},target=/go/src/github.com/docker/docker,type=bind,consistency=cached", diff --git a/Dockerfile b/Dockerfile index 6b4ff9e15d..0234218419 100644 --- a/Dockerfile +++ b/Dockerfile @@ -251,6 +251,12 @@ RUN --mount=type=cache,target=/root/.cache/go-build \ GOBIN=/build/ GO111MODULE=on go install "mvdan.cc/sh/v3/cmd/shfmt@${SHFMT_VERSION}" \ && /build/shfmt --version +FROM base AS gopls +RUN --mount=type=cache,target=/root/.cache/go-build \ + --mount=type=cache,target=/go/pkg/mod \ + GOBIN=/build/ GO111MODULE=on go install "golang.org/x/tools/gopls@latest" \ + && /build/gopls version + FROM base AS dockercli WORKDIR /go/src/github.com/docker/cli ARG DOCKERCLI_REPOSITORY @@ -655,6 +661,11 @@ RUN < make shell # > SYSTEMD=true make shell