From a6c5047be3a1b19008129a0b9160b39687626826 Mon Sep 17 00:00:00 2001 From: i0gan Date: Mon, 12 Aug 2024 14:07:35 +0000 Subject: [PATCH] Update: image script --- docker/build_image.sh | 17 +++++++++++++---- docker/release | 13 +++---------- docker/release_mini | 18 ++++++++++++++++++ docker/src_dep | 15 +++++++++++++++ tools/generate_k8s_deploy.sh | 7 +++++++ 5 files changed, 56 insertions(+), 14 deletions(-) create mode 100644 docker/release_mini create mode 100644 docker/src_dep create mode 100755 tools/generate_k8s_deploy.sh diff --git a/docker/build_image.sh b/docker/build_image.sh index 1c7a8df5..02f75c19 100755 --- a/docker/build_image.sh +++ b/docker/build_image.sh @@ -3,17 +3,22 @@ cd $(dirname $0) source ../tools/common.sh -build_type='docker' +version=$1 +if [[ $version == "" ]];then + version="1.2" +fi + +dockerfile=./docker/src_dep is_build_third_party=0 is_build_sqkctl=0 -src_image_tag=pwnsky/squick_src:1.2 -bin_image_tag=pwnsky/squick:1.2 +src_image_tag=pwnsky/squick_src:$version +bin_image_tag=pwnsky/squick:$version build_container=squick_src_build cd $project_path echo "Build src image" -docker build . -t $src_image_tag -f ./docker/src +docker build . -t $src_image_tag -f $dockerfile check_err echo "Export binary files" @@ -33,5 +38,9 @@ echo "Build release image" docker build . -t $bin_image_tag -f ./docker/release check_err +echo "Exporting the image" +docker save -o ../cache/squick_$version.tar pwnsky/squick:$version +check_err + echo "Build image ok" print_ok diff --git a/docker/release b/docker/release index bfe5f204..4622bd0c 100644 --- a/docker/release +++ b/docker/release @@ -1,18 +1,11 @@ -# cd {squick_project} -# docker build . -t i0gan/squick_src:1.1 -f ./docker/src -# docker run -d --name squick_src i0gan/squick_src:1.1 -# rm -rf ./cache/docker_deploy -# docker cp squick_src:/squick/deploy ./cache/docker_deploy - -# docker build . -t i0gan/squick:1.1 -f ./docker/release -# docker run -it --name squick i0gan/squick:1.1 - FROM ubuntu:22.04 + # Set env ARG DEBIAN_FRONTEND=noninteractive +RUN apt update && apt install -y dos2unix vim net-tools # copy from docker builded files COPY ./cache/docker_deploy /squick WORKDIR /squick RUN chmod +x /squick/script/*.sh -CMD bash /squick/script/squick.sh \ No newline at end of file +CMD bash /squick/script/squick.sh diff --git a/docker/release_mini b/docker/release_mini new file mode 100644 index 00000000..bfe5f204 --- /dev/null +++ b/docker/release_mini @@ -0,0 +1,18 @@ +# cd {squick_project} +# docker build . -t i0gan/squick_src:1.1 -f ./docker/src +# docker run -d --name squick_src i0gan/squick_src:1.1 +# rm -rf ./cache/docker_deploy +# docker cp squick_src:/squick/deploy ./cache/docker_deploy + +# docker build . -t i0gan/squick:1.1 -f ./docker/release +# docker run -it --name squick i0gan/squick:1.1 + +FROM ubuntu:22.04 +# Set env +ARG DEBIAN_FRONTEND=noninteractive + +# copy from docker builded files +COPY ./cache/docker_deploy /squick +WORKDIR /squick +RUN chmod +x /squick/script/*.sh +CMD bash /squick/script/squick.sh \ No newline at end of file diff --git a/docker/src_dep b/docker/src_dep new file mode 100644 index 00000000..3753f0ab --- /dev/null +++ b/docker/src_dep @@ -0,0 +1,15 @@ +FROM pwnsky/squick_src:1.1 + +COPY . /squick_dep + +RUN rm -rf /squick_dep/third_party && mv /squick/third_party /squick_dep && rm -rf /squick && mv /squick_dep /squick + +WORKDIR /squick +RUN cd tools && chmod +x *.sh && dos2unix *.sh +RUN cd script && chmod +x *.sh && dos2unix *.sh + +RUN bash ./tools/clean_squick.sh +RUN bash ./tools/build_sqkctl.sh +RUN bash ./tools/build_squick.sh +RUN bash ./tools/generate_deploy.sh +CMD bash /squick/script/squick.sh diff --git a/tools/generate_k8s_deploy.sh b/tools/generate_k8s_deploy.sh new file mode 100755 index 00000000..623e8548 --- /dev/null +++ b/tools/generate_k8s_deploy.sh @@ -0,0 +1,7 @@ +#! /bin/bash + +# build image +bash ../docker/build_image.sh + + +