Adds a dev container and Codespaces docs

Signed-off-by: Samruddhi Khandale <samruddhikhandale@github.com>
This commit is contained in:
Samruddhi Khandale 2023-03-21 21:05:28 +00:00
parent 3a1047319f
commit 50b576a94e
5 changed files with 111 additions and 0 deletions

28
.devcontainer/Dockerfile Normal file
View File

@ -0,0 +1,28 @@
# For details, see https://github.com/devcontainers/images/tree/main/src/base-ubuntu
FROM mcr.microsoft.com/devcontainers/base:1-ubuntu-22.04
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
&& apt-get -y install --no-install-recommends \
gperf \
dmsetup \
bc \
software-properties-common \
libseccomp-dev \
xfsprogs \
lsof \
iptables \
autoconf \
automake \
g++ \
libtool \
acl \
&& rm -rf /var/lib/apt/lists/*
RUN add-apt-repository -y ppa:criu/ppa \
&& apt-get update \
&& apt-get install -y criu \
&& rm -rf /var/lib/apt/lists/*
RUN setfacl -PRdm u::rwx,g::rx,o::rx /tmp
COPY .devcontainer/welcome-message.txt /usr/local/etc/vscode-dev-containers/first-run-notice.txt

View File

@ -0,0 +1,32 @@
// For format details, see https://aka.ms/devcontainer.json.
{
"name": "containerd",
"build": {
"context": "..",
"dockerfile": "Dockerfile"
},
"workspaceFolder": "/go/src/github.com/containerd/containerd",
"workspaceMount": "source=${localWorkspaceFolder},target=/go/src/github.com/containerd/containerd,type=bind,consistency=cached",
// Features to add to the dev container. More info: https://containers.dev/features.
"features": {
"ghcr.io/devcontainers/features/docker-in-docker:2": {},
"ghcr.io/devcontainers/features/go:1": {
"version": "1.20"
}
},
"onCreateCommand": "sudo PATH=$PATH bash .devcontainer/setup.sh",
"postAttachCommand": {
"Runs all non-integration tests that do not require `root` privileges": "make test",
"Runs non-integration tests which require `root`": "sudo PATH=$PATH make root-test"
},
"remoteUser": "root",
"runArgs": [
"--ipc=host",
"--volume=/dev:/dev",
"--volume=/run/udev:/run/udev",
"--privileged"
]
}

33
.devcontainer/setup.sh Normal file
View File

@ -0,0 +1,33 @@
#!/bin/bash
# Copyright The containerd Authors.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
set -eux
script/setup/install-seccomp
script/setup/install-runc
script/setup/install-cni $(grep containernetworking/plugins go.mod | awk '{print $2}')
script/setup/install-critools
script/setup/install-failpoint-binaries
script/setup/install-gotestsum
script/setup/install-teststat
script/setup/install-protobuf \
&& mkdir -p /go/src/usr/local/bin /go/src/usr/local/include \
&& mv /usr/local/bin/protoc /go/src/usr/local/bin/protoc \
&& mv /usr/local/include/google /go/src/usr/local/include/google
make binaries GO_BUILD_FLAGS="-mod=vendor"
sudo -E PATH=$PATH make install

View File

@ -0,0 +1,7 @@
👋 Welcome to "containerd" in GitHub Codespaces!
🛠️ Your environment is fully setup with all the required software.
🔍 To explore VS Code to its fullest, search using the Command Palette (Cmd/Ctrl + Shift + P or F1).
Look at https://github.com/containerd/project/blob/main/CONTRIBUTING.md for contribution guidelines.

View File

@ -4,12 +4,23 @@ This guide is useful if you intend to contribute on containerd. Thanks for your
effort. Every contribution is very appreciated.
This doc includes:
* [Getting started with GitHub Codespaces](#getting-started-with-gitHub-codespaces)
* [Build requirements](#build-requirements)
* [Build the development environment](#build-the-development-environment)
* [Build containerd](#build-containerd)
* [Via docker container](#via-docker-container)
* [Testing](#testing-containerd)
## Getting started with GitHub Codespaces
To get started, create a codespace for this repository by clicking this 👇
[![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://github.com/codespaces/new?hide_repo_select=true&ref=main&repo=46089560)
A codespace will open in a web-based version of Visual Studio Code. The [dev container](.devcontainer/devcontainer.json) is fully configured with software needed for this project and the containerd built. If you use a codespace, then you can directly skip to the [testing](#testing-containerd) section of this document.
**Note**: Dev containers is an open spec which is supported by [GitHub Codespaces](https://github.com/codespaces) and [other tools](https://containers.dev/supporting).
## Build requirements
To build the `containerd` daemon, and the `ctr` simple test client, the following build system dependencies are required: