Skip to content

Commit

Permalink
add harbor e2e
Browse files Browse the repository at this point in the history
  • Loading branch information
airycanon committed Aug 26, 2024
1 parent bf12bb6 commit 31ee5f2
Showing 1 changed file with 134 additions and 0 deletions.
134 changes: 134 additions & 0 deletions tests/test-engine-image/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
FROM build-harbor.alauda.cn/ops/ubuntu:22.04 as tool_builder
ENV LANG C.UTF-8
WORKDIR /tool

#RUN tdnf install -y \
RUN apt-get update && apt-get install -y \
build-essential \
wget \
git \
tar \
#go
#ubuntu
curl \
libssl-dev \
uuid-dev
#ubuntu
RUN apt-get update && apt-get install -y software-properties-common && \
add-apt-repository -y ppa:longsleep/golang-backports && \
apt-get install -y golang-go

RUN pwd && mkdir /tool/binary && \
# Install CONTAINERD
CONTAINERD_VERSION=1.4.4 && \
wget https://github.com/containerd/containerd/releases/download/v$CONTAINERD_VERSION/containerd-$CONTAINERD_VERSION-linux-amd64.tar.gz && \
tar zxvf containerd-$CONTAINERD_VERSION-linux-amd64.tar.gz && \
cd bin && cp -f containerd ctr /tool/binary/ && \
# docker compose
curl -L "https://github.com/docker/compose/releases/download/1.24.0/docker-compose-$(uname -s)-$(uname -m)" -o /tool/binary/docker-compose && \
chmod +x /tool/binary/docker-compose && \
# Install helm v2
HELM2_VERSION=2.16.12 && wget https://get.helm.sh/helm-v$HELM2_VERSION-linux-amd64.tar.gz && \
tar zxvf helm-v$HELM2_VERSION-linux-amd64.tar.gz && \
cp linux-amd64/helm /tool/binary/helm && \
cp linux-amd64/helm /tool/binary/helm2 && \
# Install helm v3
ALAUDA_HELM3_VERSION=3.5.6 && https://build-nexus.alauda.cn/repository/alauda/alauda/helm/v$ALAUDA_HELM3_VERSION/helm-linux/helm-linux && \
ls || pwd && \
mv helm-linux /tool/binary/helm3 && \
# Install helm v3.7
HELM3_7_VERSION=3.12.0 && wget https://get.helm.sh/helm-v$HELM3_7_VERSION-linux-amd64.tar.gz && \
tar zxvf helm-v$HELM3_7_VERSION-linux-amd64.tar.gz && \
ls || pwd && \
mv linux-amd64/helm /tool/binary/helm3.7 && \
# Install ORAS
ORAS_VERSION=0.12.0 && curl -LO https://github.com/deislabs/oras/releases/download/v$ORAS_VERSION/oras_${ORAS_VERSION}_linux_amd64.tar.gz && \
mkdir -p oras-install/ && \
tar -zxf oras_${ORAS_VERSION}_*.tar.gz -C oras-install/ && \
mv oras-install/oras /tool/binary/ && \
# Install notary
NOTARY_VERSION=0.6.1 && wget https://github.com/theupdateframework/notary/releases/download/v$NOTARY_VERSION/notary-Linux-amd64 && \
chmod +x notary-Linux-amd64 && \
mv notary-Linux-amd64 /tool/binary/notary && \
# Install CNAB
CNAB_PATH=$(go env GOPATH)/src/github.com/cnabio && \
mkdir -p $CNAB_PATH && cd $CNAB_PATH && git clone https://github.com/cnabio/cnab-to-oci.git && \
cd cnab-to-oci && git checkout v0.3.3 && \
go list && \
make build && \
mv bin/cnab-to-oci /tool/binary/ && \
# Install DIND
DIND_COMMIT=3b5fac462d21ca164b3778647420016315289034 && \
wget "https://raw.githubusercontent.com/docker/docker/${DIND_COMMIT}/hack/dind" -O /tool/binary/dind \
&& chmod +x /tool/binary/dind && \
# Install wasm-to-oci
WASM_TO_OCI_VERSION=0.1.2 && wget https://github.com/engineerd/wasm-to-oci/releases/download/v${WASM_TO_OCI_VERSION}/linux-amd64-wasm-to-oci && \
chmod +x linux-amd64-wasm-to-oci && mv linux-amd64-wasm-to-oci /tool/binary/wasm-to-oci && \
# Install imgpkg
IMGPKG_VERSION=0.29.0 && wget https://github.com/vmware-tanzu/carvel-imgpkg/releases/download/v$IMGPKG_VERSION/imgpkg-linux-amd64 && \
mv imgpkg-linux-amd64 /tool/binary/imgpkg && chmod +x /tool/binary/imgpkg && \
# Install cosign
COSIGN_VERSION=1.9.0 && wget https://github.com/sigstore/cosign/releases/download/v$COSIGN_VERSION/cosign-linux-amd64 && \
mv cosign-linux-amd64 /tool/binary/cosign && chmod +x /tool/binary/cosign && \
pwd

#ubuntu
RUN wget https://github.com/hpcng/singularity/releases/download/v3.3.0/singularity-3.3.0.tar.gz && \
tar -xzf singularity-3.3.0.tar.gz && \
cd singularity && \
./mconfig && \
make -C builddir && \
make -C builddir install
RUN pwd && \
ls -l /usr/local/bin && \
rm -rf singularity && \
mv /usr/local/bin/singularity /tool/binary/

RUN cd /tool/binary/ && tar czvf tools.tar.gz * && cp tools.tar.gz /tool
# --- End of base file ---
# photon based image
FROM build-harbor.alauda.cn/ops/photon:4.0
ENV LANG C.UTF-8
ENV HELM_EXPERIMENTAL_OCI=1
ENV COSIGN_PASSWORD=Harbor12345

COPY --from=tool_builder /tool/tools.tar.gz /usr/local/bin

RUN tdnf install -y \
wget \
git \
openjdk8 \
iproute2 \
iptables \
build-essential \
sed \
openssl-devel \
tar \
which \
procps-ng \
gzip && \
tdnf erase -y toybox && \
tdnf install -y python3 python3-pip python3-setuptools httpd && \
pip3 install --upgrade pip pyasn1 google-apitools==0.5.31 gsutil python-dateutil \
robotframework==3.2.1 robotframework-sshlibrary robotframework-httplibrary \
requests dbbot robotframework-seleniumlibrary==4.3.0 robotframework-pabot \
robotframework-JSONLibrary hurry.filesize --upgrade && \
tdnf clean all

RUN pwd && ls && \
# Install docker
DOCKER_VERSION=20.10.3 && wget https://download.docker.com/linux/static/stable/x86_64/docker-$DOCKER_VERSION.tgz && \
tar --strip-components=1 -xvzf docker-$DOCKER_VERSION.tgz -C /usr/bin && \
rm docker-$DOCKER_VERSION.tgz

COPY containerd_config.toml /etc/containerd/config.toml
COPY busybox.tar /
# This container needs to be run in privileged mode(run with --privileged option) to make it work
COPY dockerd-entrypoint.sh /usr/local/bin/dockerd-entrypoint.sh

RUN chmod +x /usr/local/bin/dockerd-entrypoint.sh && \
mkdir -p $HOME/.pki/nssdb && \
echo Harbor12345 > password.ca && \
certutil -d sql:$HOME/.pki/nssdb -N -f password.ca

VOLUME /var/lib/docker

0 comments on commit 31ee5f2

Please sign in to comment.