diff --git a/.github/workflows/build-&-publish-docker-image.yml b/.github/workflows/build-&-publish-docker-image.yml deleted file mode 100644 index 41d5e4a..0000000 --- a/.github/workflows/build-&-publish-docker-image.yml +++ /dev/null @@ -1,64 +0,0 @@ -name: "Build & Publish Docker Image" - -on: - push: - branches: - - staging - tags: - - '*' - pull_request: - workflow_dispatch: - -env: - DOCKER_CLI_EXPERIMENTAL: enabled - S3MGRT_REGISTRY: ${{ secrets.S3MGRT_REGISTRY }} - -jobs: - s3mgrt: - runs-on: [self-hosted, arc-runner] - steps: - - name: Set docker image tag - run: | - if [[ "${{github.ref}}" == refs/pull/* ]]; then - tag=${GITHUB_REF/\/merge/} - echo "TAG=$(echo pr-${tag:10})" >> $GITHUB_ENV - else - echo "TAG=$(echo ${GITHUB_REF#refs/*/} | sed 's/\//-/g')" >> $GITHUB_ENV - fi - - echo "BRANCH=$([ -z '${{ github.event.pull_request.head.sha }}' ] && echo ${GITHUB_REF#refs/*/} || echo $GITHUB_HEAD_REF)" >> $GITHUB_ENV - echo "SHA=$([ -z '${{ github.event.pull_request.head.sha }}' ] && echo $GITHUB_SHA || echo '${{ github.event.pull_request.head.sha }}')" >> $GITHUB_ENV - - - name: Setup go 1.18 - uses: actions/setup-go@v2 - with: - go-version: '1.18' # The Go version to download (if necessary) and use. - - - name: Clone s3migration - uses: actions/checkout@v1 - - - name: Set up Docker Buildx - run: | - sudo apt-get update -y - sudo apt-get install ca-certificates curl gnupg lsb-release -y - curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg - echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null - sudo apt-get update -y - sudo apt-get install docker-ce docker-ce-cli containerd.io -y - export DOCKER_CLI_EXPERIMENTAL=enabled - docker run --privileged --rm tonistiigi/binfmt --install all - docker context create s3mgrt_buildx - - - name: Login to Docker Hub - uses: docker/login-action@v2 - with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_PASSWORD }} - - - name: Build s3mgrt - run: | - SHORT_SHA=$(echo ${{ env.SHA }} | head -c 8) - export DOCKER_BUILD="buildx build --platform linux/amd64,linux/arm64 --push" - export DOCKER_IMAGE="-t ${{ secrets.S3MGRT_REGISTRY }}:${TAG} -t ${{ secrets.S3MGRT_REGISTRY }}:${TAG}-${SHORT_SHA}" - docker buildx create --driver-opt network=host --use --buildkitd-flags '--allow-insecure-entitlement security.insecure' --use s3mgrt_buildx - ./docker.local/bin/build.sh diff --git a/.github/workflows/build-s3-migration.yaml b/.github/workflows/build-s3-migration.yaml index 30cff0b..76d374c 100644 --- a/.github/workflows/build-s3-migration.yaml +++ b/.github/workflows/build-s3-migration.yaml @@ -9,6 +9,7 @@ on: branches: - master - staging + - test-s3mgrt tags: - 'v*.*.*' pull_request: @@ -53,7 +54,9 @@ jobs: sudo apt -y install build-essential nghttp2 libnghttp2-dev libssl-dev wget unzip containerd docker.io - name: Install - run: make build + run: | + docker build -t zbox_base -f docker.local/base.Dockerfile . + docker run --rm -v $PWD:/migrate --workdir=/migrate zbox_base make build - name: Zip release run: tar -czvf s3mgrt-linux.tar.gz ./s3mgrt @@ -267,4 +270,4 @@ jobs: repository: ${{ github.repository }} status_name: "0Chain System Tests" target_url: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} - github_token: ${{ github.token }} \ No newline at end of file + github_token: ${{ github.token }} diff --git a/docker.local/Dockerfile b/docker.local/Dockerfile deleted file mode 100644 index ad060f8..0000000 --- a/docker.local/Dockerfile +++ /dev/null @@ -1,50 +0,0 @@ -FROM ubuntu:22.04 as s3mgrt-build - -LABEL zchain="s3mgrt" - -# https://mirrors.alpinelinux.org/ -# RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories -RUN apt update && apt -y install curl build-essential nghttp2 libnghttp2-dev libssl-dev containerd docker.io - -RUN if [ "$(uname -m)" = "x86_64" ] ; then curl -L -o go1.20.4.tar.gz https://go.dev/dl/go1.20.4.linux-amd64.tar.gz ; else curl -L -o go1.20.4.tar.gz https://go.dev/dl/go1.20.4.linux-arm64.tar.gz ; fi -# RUN [ -d /usr/local/go ] && rm -rf /usr/local/go -RUN tar -C /usr/local -xzf go1.20.4.tar.gz -RUN export PATH=$PATH:/usr/local/go/bin -ENV PATH=$PATH:/usr/local/go/bin -RUN go version - -# # Install Herumi's cryptography -# WORKDIR /tmp - -# COPY ./docker.local/bin/mcl.tar.gz ./ -# COPY ./docker.local/bin/bls.tar.gz ./ - -# RUN tar zxvf mcl.tar.gz && rm mcl.tar.gz && mv mcl* mcl - -# RUN tar zxvf bls.tar.gz && rm bls.tar.gz && mv bls* bls - -# RUN make -C mcl -j $(nproc) lib/libmclbn256.so install -# RUN cp mcl/lib/libmclbn256.so /usr/local/lib - -# RUN make MCL_DIR=$(pwd)/mcl -C bls -j $(nproc) install - -# RUN rm -R /tmp/mcl && rm -R /tmp/bls - -ENV SRC_DIR=/0chain -WORKDIR $SRC_DIR - -# Download the dependencies: -# Will be cached if we don't change mod/sum files -COPY ./go.mod ./go.sum $SRC_DIR -RUN go mod download - -COPY . $SRC_DIR -RUN make build - -FROM ubuntu:22.04 -RUN apt update && apt -y install build-essential nghttp2 libnghttp2-dev libssl-dev -COPY --from=s3mgrt-build /usr/local/lib/libmcl*.so \ - /usr/local/lib/libbls*.so \ - /usr/local/lib/ - -COPY --from=s3mgrt-build /0chain/s3mgrt /usr/local/bin/s3mgrt \ No newline at end of file diff --git a/docker.local/base.Dockerfile b/docker.local/base.Dockerfile new file mode 100644 index 0000000..9be06e7 --- /dev/null +++ b/docker.local/base.Dockerfile @@ -0,0 +1,8 @@ +FROM golang:1.20.4-alpine3.18 as zbox_base + + RUN apk add --update --no-cache linux-headers build-base git cmake bash perl grep py3-pip python3-dev curl + + RUN apk upgrade + # Install Herumi's cryptography + RUN apk del libstdc++ gmp-dev openssl-dev vips-dev + RUN apk add --update --no-cache --repository http://dl-cdn.alpinelinux.org/alpine/edge/main libstdc++ gmp-dev openssl-dev vips-dev