updated docker base image to alpine:3.15 #639
Workflow file for this run
This file contains 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
name: Linux Unit tests and docker push | |
on: | |
pull_request: | |
push: | |
branches: ['master', 'dev'] | |
jobs: | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Set up Go 1.x | |
uses: actions/setup-go@v5 | |
with: | |
go-version: ^1.21 | |
id: go | |
- name: Check out code into the Go module directory | |
uses: actions/checkout@v4 | |
- name: Tidy Go modules | |
run: | | |
go mod tidy | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Install QEMU | |
uses: docker/setup-qemu-action@v2 | |
with: | |
platforms: linux/arm64,linux/amd64 | |
- name: Enable Docker BuildKit and Buildx | |
run: | | |
export DOCKER_CLI_EXPERIMENTAL=enabled | |
export DOCKER_BUILDKIT=1 | |
docker buildx create --use | |
- name: Test | |
run: | | |
make test | |
- name: Set docker image tag | |
id: get_info | |
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: Login to Docker Hub | |
uses: docker/login-action@v1 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Build & Push | |
run: | | |
SHORT_SHA=$(echo ${{ env.SHA }} | head -c 8) | |
make image | |
docker tag simplyblock/spdkcsi:latest-amd64 simplyblock/spdkcsi:$TAG-amd64 | |
docker tag simplyblock/spdkcsi:latest-arm64 simplyblock/spdkcsi:$TAG-arm64 | |
docker push simplyblock/spdkcsi:$TAG-amd64 | |
docker push simplyblock/spdkcsi:$TAG-arm64 | |
docker buildx imagetools create -t simplyblock/spdkcsi:$TAG simplyblock/spdkcsi:$TAG-amd64 simplyblock/spdkcsi:$TAG-arm64 | |
docker buildx imagetools create -t simplyblock/spdkcsi:$TAG-$SHORT_SHA simplyblock/spdkcsi:$TAG-amd64 simplyblock/spdkcsi:$TAG-arm64 | |
if [ "${{ github.ref }}" = "refs/heads/master" ]; then | |
docker buildx imagetools create -t simplyblock/spdkcsi:latest simplyblock/spdkcsi:$TAG-amd64 simplyblock/spdkcsi:$TAG-arm64 | |
fi |