diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 0000000..be982bf --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,112 @@ +jobs: + build-branches-amd64: + machine: true + steps: + - checkout + - run: + name: Build an amd64 container image + command: | + docker build -t wise2c-devops/golang:alpine-gcc -f golang-gcc/Dockerfile golang-gcc + docker run -v $(pwd):/go/src/github.com/wise2c-devops/pagoda -w /go/src/github.com/wise2c-devops/pagoda wise2c-devops/golang:alpine-gcc go build + docker build -t wise2c/pagoda:amd64-$CIRCLE_BRANCH . + docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD + docker push wise2c/pagoda:amd64-$CIRCLE_BRANCH + + build-tags-amd64: + machine: true + steps: + - checkout + - run: + name: Build an amd64 container image + command: | + docker build -t wise2c-devops/golang:alpine-gcc -f golang-gcc/Dockerfile golang-gcc + docker run -v $(pwd):/go/src/github.com/wise2c-devops/pagoda -w /go/src/github.com/wise2c-devops/pagoda wise2c-devops/golang:alpine-gcc go build + docker build -t wise2c/pagoda:amd64-$CIRCLE_TAG . + docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD + docker push wise2c/pagoda:amd64-$CIRCLE_TAG + + build-branches-aarch64: + machine: true + resource_class: arm.medium + steps: + - checkout + - run: + name: Build an aarch64 container image + command: | + docker build -t wise2c-devops/golang:alpine-gcc -f golang-gcc/Dockerfile golang-gcc + docker run -v $(pwd):/go/src/github.com/wise2c-devops/pagoda -w /go/src/github.com/wise2c-devops/pagoda wise2c-devops/golang:alpine-gcc go build + docker build -t wise2c/pagoda:aarch64-$CIRCLE_BRANCH . + docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD + docker push wise2c/pagoda:aarch64-$CIRCLE_BRANCH + + build-tags-aarch64: + resource_class: arm.medium + machine: true + steps: + - checkout + - run: + name: Build an aarch64 container image + command: | + docker build -t wise2c-devops/golang:alpine-gcc -f golang-gcc/Dockerfile golang-gcc + docker run -v $(pwd):/go/src/github.com/wise2c-devops/pagoda -w /go/src/github.com/wise2c-devops/pagoda wise2c-devops/golang:alpine-gcc go build + docker build -t wise2c/pagoda:aarch64-$CIRCLE_TAG . + docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD + docker push wise2c/pagoda:aarch64-$CIRCLE_TAG + + build-branches-multi-arch: + machine: true + steps: + - run: + name: Build a multi-arch container image + command: | + docker manifest create wise2c/pagoda:$CIRCLE_BRANCH wise2c/pagoda:amd64-$CIRCLE_BRANCH wise2c/pagoda:aarch64-$CIRCLE_BRANCH + docker manifest annotate wise2c/pagoda:$CIRCLE_BRANCH wise2c/pagoda:amd64-$CIRCLE_BRANCH --os linux --arch amd64 + docker manifest annotate wise2c/pagoda:$CIRCLE_BRANCH wise2c/pagoda:aarch64-$CIRCLE_BRANCH --os linux --arch arm64 + docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD + docker manifest push wise2c/pagoda:$CIRCLE_BRANCH + + build-tags-multi-arch: + machine: true + steps: + - run: + name: Build a multi-arch container image + command: | + docker manifest create wise2c/pagoda:$CIRCLE_TAG wise2c/pagoda:amd64-$CIRCLE_TAG wise2c/pagoda:aarch64-$CIRCLE_TAG + docker manifest annotate wise2c/pagoda:$CIRCLE_TAG wise2c/pagoda:amd64-$CIRCLE_TAG --os linux --arch amd64 + docker manifest annotate wise2c/pagoda:$CIRCLE_TAG wise2c/pagoda:aarch64-$CIRCLE_TAG --os linux --arch arm64 + docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD + docker manifest push wise2c/pagoda:$CIRCLE_TAG + +workflows: + version: 2 + build-for-branches: + jobs: + - build-branches-amd64 + - build-branches-aarch64 + - build-branches-multi-arch: + requires: + - build-branches-amd64 + - build-branches-aarch64 + build-for-tags: + jobs: + - build-tags-amd64: + filters: + tags: + only: /^v.*/ + branches: + ignore: /.*/ + - build-tags-aarch64: + filters: + tags: + only: /^v.*/ + branches: + ignore: /.*/ + - build-tags-multi-arch: + requires: + - build-tags-amd64 + - build-tags-aarch64 + filters: + tags: + only: /^v.*/ + branches: + ignore: /.*/