-
Notifications
You must be signed in to change notification settings - Fork 188
Add test container based on Alpine image. #953
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
Draft
amirouche
wants to merge
1
commit into
nestybox:master
Choose a base branch
from
amirouche:support-alpine-host
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,167 @@ | ||
FROM alpine:3.22 | ||
|
||
# K8s version for k8s-in-docker (i.e., this should be equal or greater than the | ||
# version of K8s running inside the k8s-in-docker container). | ||
ARG k8s_version=v1.28 | ||
ARG k8s_version_full=v1.28.2 | ||
|
||
# CRI-O & crictl version for testing sysbox pods; should match K8s version. | ||
ARG crio_version=v1.28 | ||
ARG crictl_version=v1.28.0 | ||
|
||
# Desired platform architecture to build upon. | ||
ARG sys_arch | ||
ENV SYS_ARCH=${sys_arch} | ||
ARG target_arch | ||
ENV TARGET_ARCH=${target_arch} | ||
|
||
RUN apk update && apk add \ | ||
alpine-sdk \ | ||
acl \ | ||
gcc \ | ||
musl-dev \ | ||
gcompat \ | ||
automake \ | ||
autoconf \ | ||
libtool \ | ||
procps-ng procps-compat \ | ||
psmisc \ | ||
nano \ | ||
less \ | ||
curl \ | ||
sudo \ | ||
gawk \ | ||
git \ | ||
iptables \ | ||
jq \ | ||
pkgconf \ | ||
libaio-dev \ | ||
libcap-dev \ | ||
libprotobuf \ | ||
protobuf \ | ||
protobuf-c-dev \ | ||
libnl3-dev \ | ||
libnet-dev \ | ||
libseccomp \ | ||
libseccomp-dev \ | ||
libseccomp-static \ | ||
protobuf-c-compiler \ | ||
protobuf-dev \ | ||
python3 \ | ||
shadow-subids \ | ||
kmod \ | ||
unzip \ | ||
time \ | ||
net-tools \ | ||
lsb-release-minimal \ | ||
wget \ | ||
lsof \ | ||
iproute2 \ | ||
iputils-ping \ | ||
ca-certificates \ | ||
bc \ | ||
openssh \ | ||
shellcheck \ | ||
gperf \ | ||
# sysbox deps | ||
fuse \ | ||
rsync \ | ||
bash-completion \ | ||
attr \ | ||
tree \ | ||
shadow \ | ||
strace \ | ||
&& rm -rf /var/cache/apk/* \ | ||
&& echo ". /etc/bash_completion" >> /etc/bash.bashrc \ | ||
&& ssh-keygen -t rsa -N "" -f ~/.ssh/id_rsa \ | ||
&& echo " StrictHostKeyChecking accept-new" >> /etc/ssh/ssh_config | ||
|
||
# Install Golang | ||
RUN wget https://go.dev/dl/go1.22.6.linux-${sys_arch}.tar.gz && \ | ||
tar -C /usr/local -xzf go1.22.6.linux-${sys_arch}.tar.gz && \ | ||
/usr/local/go/bin/go env -w GONOSUMDB=/root/nestybox | ||
|
||
ENV GOPATH=/go | ||
ENV PATH=$GOPATH/bin:/usr/local/go/bin:$PATH | ||
RUN go env -w GONOSUMDB=/root/nestybox && \ | ||
mkdir -p "$GOPATH/src" "$GOPATH/bin" && \ | ||
chmod -R 777 "$GOPATH" | ||
|
||
# Add a dummy user for the rootless integration tests; needed by the | ||
# `git clone` operations below. | ||
RUN useradd -u1000 -m -d/home/rootless -s/bin/bash rootless | ||
|
||
# install bats | ||
RUN cd /tmp \ | ||
&& git clone https://github.com/sstephenson/bats.git \ | ||
&& cd bats \ | ||
&& git reset --hard 03608115df2071fff4eaaff1605768c275e5f81f \ | ||
&& ./install.sh /usr/local \ | ||
&& rm -rf /tmp/bats | ||
|
||
# install protoc compiler for gRPC | ||
RUN if [ "$sys_arch" = "amd64" ] ; then arch_str="x86_64"; \ | ||
elif [ "$sys_arch" = "arm64" ]; then arch_str="aarch_64"; \ | ||
else echo "Unsupported platform: ${sys_arch}"; exit; fi \ | ||
&& curl -LO https://github.com/protocolbuffers/protobuf/releases/download/v3.15.8/protoc-3.15.8-linux-${arch_str}.zip \ | ||
&& unzip protoc-3.15.8-linux-${arch_str}.zip -d $HOME/.local \ | ||
&& export PATH="$PATH:$HOME/.local/bin" \ | ||
&& go install github.com/golang/protobuf/protoc-gen-go@latest \ | ||
&& export PATH="$PATH:$(go env GOPATH)/bin" | ||
|
||
# Install Docker | ||
RUN apk add --update docker openrc | ||
RUN rc-update add docker boot | ||
ADD https://raw.githubusercontent.com/docker/docker-ce/master/components/cli/contrib/completion/bash/docker /etc/bash_completion.d/docker.sh | ||
|
||
# Go Dlv for debugging | ||
RUN go install github.com/go-delve/delve/cmd/dlv@latest | ||
|
||
# Install Kubectl for k8s-in-docker integration-testing. Notice that we are explicitly | ||
# stating the kubectl version to download, which should match the K8s release | ||
# deployed in the K8s-in-docker nodes (L2). | ||
RUN cd /tmp && curl -LO "https://dl.k8s.io/release/${k8s_version_full}/bin/linux/amd64/kubectl" \ | ||
&& install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl \ | ||
&& rm /tmp/kubectl | ||
|
||
# Install the upstream CRI-O so we get the cri-o binary plus all config files, | ||
# etc. Later we will replace the binary with our forked Nestybox CRI-O that | ||
# works with Sysbox. | ||
# | ||
# Instructions: https://cri-o.io/ | ||
RUN apk update && apk add cri-o | ||
|
||
|
||
# Dasel (for yaml, toml, json parsing) (https://github.com/TomWright/dasel) | ||
# Note: manually download Dasel v1 as our testContainerInit script does not yet support Dasel v2. | ||
RUN wget https://github.com/TomWright/dasel/releases/download/v1.27.2/dasel_linux_${sys_arch} && mv dasel_linux_${sys_arch} dasel && chmod +x dasel \ | ||
&& mv ./dasel /usr/local/bin/dasel | ||
|
||
# K8s.io KinD | ||
RUN go install sigs.k8s.io/[email protected] | ||
|
||
# Use the old definition for SECCOMP_NOTIF_ID_VALID in /usr/include/linux/seccomp.h | ||
# | ||
# This is needed because the definition changed in the mainline kernel | ||
# on 06/2020 (from SECCOMP_IOR -> SECCOMP_IOW), and some distros we | ||
# support have picked it up in their latest releases / kernels | ||
# updates. The kernel change was backward compatible, so by using the | ||
# old definition, we are guaranteed it will work on kernels before and | ||
# after the change. On the other hand, if we were to use the new | ||
# definition, seccomp notify would fail when sysbox runs in old | ||
# kernels. | ||
RUN sed -i 's/^#define SECCOMP_IOCTL_NOTIF_ID_VALID[ \t]*SECCOMP_IOW(2, __u64)/#define SECCOMP_IOCTL_NOTIF_ID_VALID SECCOMP_IOR(2, __u64)/g' /usr/include/linux/seccomp.h | ||
|
||
# sysbox env | ||
RUN useradd sysbox \ | ||
&& mkdir -p /var/lib/sysboxfs | ||
|
||
# test scripts | ||
COPY scr/testContainerInit /usr/bin | ||
COPY scr/testContainerCleanup /usr/bin | ||
COPY scr/buildContainerInit /usr/bin | ||
COPY bin/userns_child_exec_${sys_arch} /usr/bin | ||
|
||
RUN mkdir -p /root/nestybox | ||
WORKDIR /root/nestybox/sysbox | ||
CMD /bin/bash |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We are missing the installation of the Nestybox forked CRI-O here, as well as
crictl
and CNIs; similar to: