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

add e2e envs to devcontainer #2032

Merged
merged 15 commits into from
May 22, 2023
Merged
26 changes: 8 additions & 18 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,24 +1,14 @@
{
"name": "Vald",
"image": "vdaas/vald-dev-container:nightly",
"dockerFile": "../dockers/dev/Dockerfile",
"context": "..",
"runArgs": ["--cap-add=SYS_PTRACE", "--security-opt", "seccomp=unconfined"],

"settings": {
"terminal.integrated.shell.linux": "/bin/bash",
"go.useGoProxyToCheckForToolUpdates": false,
"go.useLanguageServer": true,
"go.autocompleteUnimportedPackages": true,
"go.buildOnSave": true,
"go.vetOnSave": true,
"go.lintOnSave": true,
"go.testOnSave": true,
"go.gopath": "/go"
"features": {
"ghcr.io/devcontainers/features/docker-in-docker:2": {
"version": "latest",
"enableNonRootDocker": "true",
"moby": "true"
}
},
"extensions": [
"golang.Go",
"zxh404.vscode-proto3",
"wayou.vscode-todo-highlight",
"esbenp.prettier-vscode"
],
"postCreateCommand": "go version"
}
2 changes: 1 addition & 1 deletion Makefile.d/k3d.mk
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ k3d/install: $(BINDIR)/k3d

$(BINDIR)/k3d:
mkdir -p $(BINDIR)
wget -q -O - "https://raw.githubusercontent.com/rancher/k3d/main/install.sh" | bash
curl -sS https://raw.githubusercontent.com/k3d-io/k3d/main/install.sh | bash
chmod a+x $(BINDIR)/$(K3D_COMMAND)

.PHONY: k3d/start
Expand Down
3 changes: 2 additions & 1 deletion Makefile.d/tools.mk
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@ $(BINDIR)/kubectl:
chmod a+x $(BINDIR)/kubectl
else
$(BINDIR)/kubectl:
curl -L "https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl" -o $(BINDIR)/kubectl
curl -LO "https://dl.k8s.io/release/$(shell curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
install -o root -g root -m 0755 kubectl $(BINDIR)/kubectl
kpango marked this conversation as resolved.
Show resolved Hide resolved
chmod a+x $(BINDIR)/kubectl
endif

Expand Down
23 changes: 9 additions & 14 deletions dockers/dev/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,6 @@

ARG MAINTAINER="vdaas.org vald team <[email protected]>"

FROM ubuntu:devel AS builder

# skipcq: DOK-DL3008
RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates \
curl \
unzip \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

WORKDIR /tmp

# skipcq: DOK-DL3026
FROM mcr.microsoft.com/vscode/devcontainers/go:1 AS base
LABEL maintainer "${MAINTAINER}"
Expand Down Expand Up @@ -64,12 +52,19 @@ COPY versions versions
RUN make ngt/install \
&& make helm/install \
&& make helm-docs/install \
&& make kind/install \
&& make valdcli/install \
&& make yq/install \
&& make golangci-lint/install \
&& make reviewdog/install \
&& make protobuf/install \
&& make kubectl/install \
&& make protobuf/install
&& make k3d/install

# k9s
# 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
ykadowak marked this conversation as resolved.
Show resolved Hide resolved
ykadowak marked this conversation as resolved.
Show resolved Hide resolved

WORKDIR ${GOPATH}
17 changes: 3 additions & 14 deletions dockers/dev/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@

`vald-dev-container` is designed for the development of Vald on Docker.

This image includes some libraries required for implementation and is based on `ubuntu:devel` image.
This image includes some libraries required to develop Vald and is based on [`mcr.microsoft.com/vscode/devcontainers/go:1`](https://hub.docker.com/_/microsoft-vscode-devcontainers) image.

<div align="center">
<img src="https://github.com/vdaas/vald/blob/main/assets/image/readme.svg?raw=true" width="50%" />
</div>

[![latest Image](https://img.shields.io/docker/v/vdaas/vald-dev-container/latest?label=vald-dev-container)](https://hub.docker.com/r/vdaas/vald-dev-container/tags?page=1&name=latest)
[![latest Image](https://img.shields.io/docker/v/vdaas/vald-dev-container/latest?label=vald-dev-container)](https://hub.docker.com/r/vdaas/vald-dev-container/tags?page=1&name=nightly)
[![License: Apache 2.0](https://img.shields.io/github/license/vdaas/vald.svg?style=flat-square)](https://opensource.org/licenses/Apache-2.0)
[![latest ver.](https://img.shields.io/github/release/vdaas/vald.svg?style=flat-square)](https://github.com/vdaas/vald/releases/latest)
[![Twitter](https://img.shields.io/badge/twitter-follow-blue?logo=twitter&style=flat-square)](https://twitter.com/vdaas_vald)
Expand All @@ -24,31 +24,20 @@ This image includes some libraries required for implementation and is based on `
- CPU instruction: requires `AVX2` or `AVX512`
- Tools: Docker

### linux/arm64

- CPU instruction: NOT Apple Silicon
- Tools: Docker

## Get Started

<!-- Get Started -->
<!-- Vald Agent NGT requires more chapter Agent Standalone -->

`vald-dev-container` is used for contributing to Vald's project.

```bash
docker pull vdaas/vald-dev-container
docker run -name vald-dev -dit vdaas/vald-dev-container
docker exec -it vald-dev /bin/bash
```
Please use this container with [our Dev Container settings](https://github.com/vdaas/vald/blob/main/.devcontainer/devcontainer.json).

## Versions

| tag | linux/amd64 | linux/arm64 | description |
| :------ | :---------: | :---------: | :------------------------------------------------------------------------------------------------------------------------------ |
| latest | ✅ | ✅ | the latest image is the same as the latest version of [vdaas/vald](https://github.com/vdaas/vald) repository version. |
| nightly | ✅ | ✅ | the nightly applies the main branch's source code of the [vdaas/vald](https://github.com/vdaas/vald) repository. |
| vX.Y.Z | ✅ | ✅ | the vX.Y.Z image applies the source code of the [vdaas/vald](https://github.com/vdaas/vald) repository. |
| pr-XXX | ✅ | ❌ | the pr-XXX image applies the source code of the pull request XXX of the [vdaas/vald](https://github.com/vdaas/vald) repository. |

## Dockerfile
Expand Down