Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Install additional tools for docker image for devcontainer #2101

Merged
merged 10 commits into from
Jul 4, 2023
3 changes: 2 additions & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
"moby": "true"
}
},
"remoteUser": "root",
"postCreateCommand": "go version",
"postAttachCommand": "sudo ln -s $(pwd)/cmd/agent/core/ngt/sample.yaml /etc/server/config.yaml",
"postAttachCommand": "mkdir -p /etc/server && ln -s $(pwd)/cmd/agent/core/ngt/sample.yaml /etc/server/config.yaml",
"appPort": "3000:3000"
}
12 changes: 12 additions & 0 deletions Makefile.d/tools.mk
Original file line number Diff line number Diff line change
Expand Up @@ -92,3 +92,15 @@ $(BINDIR)/buf:
"https://github.com/bufbuild/buf/releases/download/$(BUF_VERSION)/buf-$(shell uname -s)-$(shell uname -m)" \
-o "${BINDIR}/buf" && \
chmod +x "${BINDIR}/buf"

.PHONY: k9s/install
k9s/install: $(GOPATH)/bin/k9s

$(GOPATH)/bin/k9s:
$(call go-install, github.com/derailed/k9s)

.PHONY: stern/install
stern/install: $(GOPATH)/bin/stern

$(GOPATH)/bin/stern:
$(call go-install, github.com/stern/stern)
25 changes: 9 additions & 16 deletions dockers/dev/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -44,31 +44,24 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
&& rm -rf /var/lib/apt/lists/*

WORKDIR ${GOPATH}/src/github.com/vdaas/vald

COPY Makefile .
COPY Makefile.d Makefile.d
COPY versions versions
COPY hack/go.mod.default hack/go.mod.default

RUN make ngt/install \
# basic deps
RUN make deps \
&& make ngt/install \
&& make helm/install \
&& make helm-docs/install \
&& make valdcli/install \
&& make yq/install \
&& make golangci-lint/install \
&& make reviewdog/install \
&& make protobuf/install \
&& make kubectl/install \
&& make k3d/install

# change GOPATH owner to vscode to run commands as user vscode without root permission
RUN chown -R vscode:vscode "${GOPATH}" \
# mkdir for agent configuration install
&& mkdir -p /etc/server

# k9s installs the binary to the current user which is root for devcontainer
# so change the current user to vscode to user afterwards
USER vscode
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
RUN curl -sS https://webinstall.dev/k9s | bash
&& make kubectl/install

RUN go install github.com/stern/stern@latest
# additional deps
RUN make k3d/install \
&& make buf/install \
&& make k9s/install