Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions base-image/k8s/Dockerfile.base → base-image/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ubuntu:20.04 as build
FROM ubuntu:20.04 AS build

RUN sed -i s@/archive.ubuntu.com/@/mirror.ubuntu.ikoula.com/@g /etc/apt/sources.list && \
sed -i s@/security.ubuntu.com/@/mirror.ubuntu.ikoula.com/@g /etc/apt/sources.list && \
Expand All @@ -10,6 +10,7 @@ RUN apt-get update \
pkg-config \
unzip \
build-essential

ARG VERSION=latest
RUN echo $VERSION > /VERSION

Expand All @@ -22,7 +23,6 @@ RUN cd /cvm-agent/apploader \
GOPROXY=https://goproxy.cn,direct \
go build -ldflags "-w -s -X apploader/version.version=${VERSION}" -o apploader


RUN cd /cvm-agent/cvmassistants/pkitool \
&& PATH=$PATH:/usr/local/go/bin \
GOPROXY=https://goproxy.cn,direct \
Expand All @@ -42,7 +42,6 @@ RUN apt-get install -y \
libcbor-dev

# RA-TLS DCAP libraries:

RUN echo 'deb [arch=amd64] https://download.01.org/intel-sgx/sgx_repo/ubuntu focal main' | tee /etc/apt/sources.list.d/intel-sgx.list > /dev/null \
&& wget -O - https://download.01.org/intel-sgx/sgx_repo/ubuntu/intel-sgx-deb.key | apt-key add -\
&& apt-get update \
Expand All @@ -54,7 +53,6 @@ RUN echo 'deb [arch=amd64] https://download.01.org/intel-sgx/sgx_repo/ubuntu foc
libtdx-attest-dev=1.20.100.2-focal1 \
libsgx-dcap-default-qpl-dev


RUN mkdir -p $HOME/.cargo/ && echo '[source.crates-io] \n registry = "git://mirrors.ustc.edu.cn/crates.io-index"' >> $HOME/.cargo/config

## todovm-cal 1005.1
Expand All @@ -73,7 +71,6 @@ RUN cd /cvm-agent/cvmassistants/keyprovider/key-provider-agent \
RUN cd /cvm-agent/cvmassistants/secretprovider/secret-provider-agent \
&& make all


# build attest-helper
RUN git clone https://github.com/guanzhi/GmSSL.git \
&& cd GmSSL \
Expand All @@ -83,11 +80,13 @@ RUN git clone https://github.com/guanzhi/GmSSL.git \
&& sed -i "s/qw\/glob/qw\/:glob/g" test/build.info \
&& ./config --prefix=/opt/gmssl \
&& make install

RUN cd /cvm-agent/cvmassistants/attest-helper \
&& PATH=$PATH:/usr/local/go/bin \
GOPROXY=https://goproxy.cn,direct \
go build

# Final image
FROM ubuntu:20.04

RUN sed -i s@/archive.ubuntu.com/@/mirror.ubuntu.ikoula.com/@g /etc/apt/sources.list && \
Expand Down Expand Up @@ -122,7 +121,6 @@ COPY --from=build /cvm-agent/apploader/conf /workplace/apploader/conf/
#get network-tool
COPY --from=build /cvm-agent/cvmassistants/network-tool/network-config.sh /workplace/cvm-agent/cvmassistants/network-tool/


# get pkitool
COPY --from=build /cvm-agent/cvmassistants/pkitool/pkitool /workplace/cvm-agent/cvmassistants/pkitool
COPY --from=build /cvm-agent/cvmassistants/pkitool/conf /workplace/cvm-agent/cvmassistants/pkitool/conf
Expand Down Expand Up @@ -178,7 +176,7 @@ RUN apt-get update \
curl \
&& pip3 install requests -i https://pypi.tuna.tsinghua.edu.cn/simple
#todo make supervisord.conf configurable so that it can change the log path
COPY --from=build /cvm-agent/base-image/k8s/supervisord.conf /etc/supervisor/
COPY --from=build /cvm-agent/base-image/supervisord/supervisord.conf /etc/supervisor/
COPY --from=build /cvm-agent/apploader/conf/appload-supervisord.ini /workplace/supervisord/apploader

#get attest-helper
Expand Down
40 changes: 20 additions & 20 deletions base-image/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,36 +2,36 @@
set -o errexit
set -x
BASE_NAME=cvm-base
BASEDIR="$( cd "$( dirname "$0" )" && pwd )"
BASE_DIR="$( cd "$( dirname "$0" )" && pwd )"
VERSION=$(git tag -l --points-at HEAD|awk -F'v' '{print $2}')
buildTime=$(date +%F-%H)
git_commit=$(git log -n 1 --pretty --format=%h)

if [ -z "$VERSION" ];then
if [ -z "$VERSION" ] ; then
VERSION=latest
fi
release_desc=${VERSION}-${git_commit}-${buildTime}

git_commit="$(git rev-parse --short=8 HEAD)"
build_time=$(date +%F-%H-%M-%S)
release_desc="${VERSION}-${git_commit}-${build_time}"

function build::image() {
PROXY=$1
echo "---> Build Image"
cd $BASEDIR/../
HOME=`pwd`
rm -rf $BASEDIR/../../docker-release
cp -a $BASEDIR/../base-image/k8s $BASEDIR/../../docker-release
cd $BASEDIR/../../docker-release
cp -r /usr/share/zoneinfo .
echo "---> Build Image"
# create docker-release next to conker-base clone
rm -rf $BASE_DIR/../../docker-release
mkdir -p $BASE_DIR/../../docker-release/tmp
cp -a $BASE_DIR/Dockerfile $BASE_DIR/../../docker-release
cp -a $BASE_DIR/supervisord/* $BASE_DIR/../../docker-release

mkdir tmp
cp -a $BASEDIR/../* tmp
docker build --no-cache --build-arg VERSION=$release_desc --build-arg https_proxy=${PROXY} -t $BASE_NAME:${VERSION} -f Dockerfile.base .
cd $HOME
}
# move to docker-release
cd $BASE_DIR/../../docker-release
cp -a /usr/share/zoneinfo .
cp -a $BASE_DIR/../* tmp

docker build --no-cache --build-arg VERSION=$release_desc --build-arg https_proxy=${PROXY} -t $BASE_NAME:${VERSION} .
}

case $1 in
buildimage)
build::image $2
;;
buildimage)
build::image $2
;;
esac
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ Restart=on-failure
RestartSec=42s

[Install]
WantedBy=multi-user.target
WantedBy=multi-user.target