diff --git a/.circleci/config.yml b/.circleci/config.yml index 390b39b..a31509a 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,30 +1,121 @@ version: 2.1 - -workflows: - build: - jobs: - - build: - context: - - esp-project - jobs: - build: + build-dev: machine: image: ubuntu-2004:202104-01 environment: DOCKER_BUILDKIT: 1 - BUILDX_PLATFORMS: linux/amd64,linux/arm64,linux/arm/v6,linux/arm/v7,linux/riscv64,linux/386 + BUILDX_PLATFORMS: linux/amd64,linux/arm64,linux/arm/v7 steps: - checkout - run: - name: Unit Tests - command: make test + name: Log in to docker hub + command: | + docker login -u $DOCKER_USER -p $DOCKER_PASS + - run: + name: Install buildx + command: | + BUILDX_BINARY_URL="https://github.com/docker/buildx/releases/download/v0.4.2/buildx-v0.4.2.linux-amd64" + curl --output docker-buildx \ + --silent --show-error --location --fail --retry 3 \ + "$BUILDX_BINARY_URL" + mkdir -p ~/.docker/cli-plugins + mv docker-buildx ~/.docker/cli-plugins/ + chmod a+x ~/.docker/cli-plugins/docker-buildx + docker buildx install + # Run binfmt + docker run --rm --privileged tonistiigi/binfmt:latest --install "$BUILDX_PLATFORMS" - run: - name: Login to Registry + name: Make Images via Buildx + command: | + BUILDX_PLATFORMS="$BUILDX_PLATFORMS" make cross-build-dev + build-master: + machine: + image: ubuntu-2004:202104-01 + environment: + DOCKER_BUILDKIT: 1 + BUILDX_PLATFORMS: linux/amd64,linux/arm64,linux/arm/v7 + steps: + - checkout + - run: + name: Log in to docker hub command: | docker login -u $DOCKER_USER -p $DOCKER_PASS - run: - name: Build from Dockerfile + name: Install buildx command: | - TAG=edge make build - + BUILDX_BINARY_URL="https://github.com/docker/buildx/releases/download/v0.4.2/buildx-v0.4.2.linux-amd64" + curl --output docker-buildx \ + --silent --show-error --location --fail --retry 3 \ + "$BUILDX_BINARY_URL" + mkdir -p ~/.docker/cli-plugins + mv docker-buildx ~/.docker/cli-plugins/ + chmod a+x ~/.docker/cli-plugins/docker-buildx + docker buildx install + # Run binfmt + docker run --rm --privileged tonistiigi/binfmt:latest --install "$BUILDX_PLATFORMS" + - run: + name: Make Images via Buildx + command: | + BUILDX_PLATFORMS="$BUILDX_PLATFORMS" make cross-build-latest + build-tags: + machine: + image: ubuntu-2004:202104-01 + environment: + DOCKER_BUILDKIT: 1 + BUILDX_PLATFORMS: linux/amd64,linux/arm64,linux/arm/v7 + steps: + - checkout + - run: + name: Log in to docker hub + command: | + docker login -u $DOCKER_USER -p $DOCKER_PASS + - run: + name: Install buildx + command: | + BUILDX_BINARY_URL="https://github.com/docker/buildx/releases/download/v0.4.2/buildx-v0.4.2.linux-amd64" + curl --output docker-buildx \ + --silent --show-error --location --fail --retry 3 \ + "$BUILDX_BINARY_URL" + mkdir -p ~/.docker/cli-plugins + mv docker-buildx ~/.docker/cli-plugins/ + chmod a+x ~/.docker/cli-plugins/docker-buildx + docker buildx install + # Run binfmt + docker run --rm --privileged tonistiigi/binfmt:latest --install "$BUILDX_PLATFORMS" + - run: + name: Make Images via Buildx + command: | + BUILDX_PLATFORMS="$BUILDX_PLATFORMS" make cross-build +workflows: + version: 2 + build-branch-dev: + jobs: + - build-dev: + context: + - esp-project + filters: + branches: + only: + - dev + build-branch-master: + jobs: + - build-master: + context: + - esp-project + filters: + branches: + only: + - master + build-branch-tags: + jobs: + - build-tags: + context: + - esp-project + filters: + tags: + only: + - /^v.*/ + branches: + ignore: + - /.*/ diff --git a/Makefile b/Makefile index c426904..90c50ac 100644 --- a/Makefile +++ b/Makefile @@ -17,10 +17,11 @@ HUB_USER?=iammrcupp HUB_REPO?=${GIT_REPO} HUB_PULL_SECRET?=$(shell docker secret list | grep DockerHub | cut -f1 -d' ') TAG?=${GIT_TAG} -DEV_IMAGE?=${HUB_REPO}:latest +DEV_LOCAL_IMAGE?=${HUB_REPO}:edge +DEV_IMAGE?=${HUB_USER}/${HUB_REPO}:edge PROD_IMAGE?=${HUB_USER}/${HUB_REPO}:${TAG} -PROD_IMAGE_2?=${HUB_USER}/${HUB_REPO}:latest -BUILDX_PLATFORMS?=linux/amd64,linux/arm64,linux/arm/v6,linux/arm/v7,linux/riscv64,linux/386 +PROD_IMAGE_LATEST?=${HUB_USER}/${HUB_REPO}:latest +BUILDX_PLATFORMS?=linux/amd64,linux/arm64,linux/arm/v7 ############################################################################### # make stuff here @@ -28,7 +29,7 @@ BUILDX_PLATFORMS?=linux/amd64,linux/arm64,linux/arm/v6,linux/arm/v7,linux/riscv6 # build image locally and use it for DEV purposes .PHONY: dev dev: - @COMPOSE_DOCKER_CLI_BUILD=1 IMAGE=${DEV_IMAGE} docker-compose -f docker-compose.yaml up --build + @COMPOSE_DOCKER_CLI_BUILD=1 IMAGE=${DEV_LOCAL_IMAGE} docker-compose -f docker-compose.yaml up --build --force-recreate # run unit tests .PHONY: build-test unit-test test @@ -84,7 +85,11 @@ endif .PHONY: cross-build cross-build-dev cross-build: @docker buildx create --name mutiarchbuilder --use - @docker buildx build --platform ${BUILDX_PLATFORMS} -t ${PROD_IMAGE} -t ${PROD_IMAGE_2} --push . + @docker buildx build --platform ${BUILDX_PLATFORMS} -t ${PROD_IMAGE} -t ${PROD_IMAGE_LATEST} --push . + +cross-build-latest: + @docker buildx create --name mutiarchbuilder --use + @docker buildx build --platform ${BUILDX_PLATFORMS} -t ${PROD_IMAGE_LATEST} --push . cross-build-dev: @docker buildx create --name mutiarchbuilder --use diff --git a/README.md b/README.md index ad9b8ac..5faacce 100644 --- a/README.md +++ b/README.md @@ -1,17 +1,30 @@ -Emotional Support Pizza +MASTER: [![CircleCI](https://circleci.com/gh/IamMrCupp/esp-project/tree/master.svg?style=svg)](https://circleci.com/gh/IamMrCupp/esp-project/tree/master) +DEV: [![CircleCI](https://circleci.com/gh/IamMrCupp/esp-project/tree/master.svg?style=svg)](https://circleci.com/gh/IamMrCupp/esp-project/tree/dev) -Master: [![CircleCI](https://circleci.com/gh/IamMrCupp/esp-project/tree/master.svg?style=svg)](https://circleci.com/gh/IamMrCupp/esp-project/tree/master) -Dev: [![CircleCI](https://circleci.com/gh/IamMrCupp/esp-project/tree/master.svg?style=svg)](https://circleci.com/gh/IamMrCupp/esp-project/tree/dev) +**Emotional Support Pizza** + +This is the website for my pizza business. +We can be found at https://emotionalsupportpizza.com + +This is very basic for now but will eventually have many more components as the site gets built out. + + + +**The website uses the following technology:** +- [![npm version](https://badge.fury.io/js/bootstrap.svg)](https://badge.fury.io/js/bootstrap) bootstrap +- [![npm version](https://badge.fury.io/js/%40fortawesome%2Ffontawesome-free.svg)](https://badge.fury.io/js/%40fortawesome%2Ffontawesome-free) fontawesome +- [![npm version](https://badge.fury.io/js/browser-sync.svg)](https://badge.fury.io/js/browser-sync) browser-sync +- [![npm version](https://badge.fury.io/js/gulp.svg)](https://badge.fury.io/js/gulp) gulp +- [![npm version](https://badge.fury.io/js/gulp-sass.svg)](https://badge.fury.io/js/gulp-sass) gulp-sass +- [![npm version](https://badge.fury.io/js/sass.svg)](https://badge.fury.io/js/sass) sass +- [![npm version](https://badge.fury.io/js/node-sass.svg)](https://badge.fury.io/js/node-sass) node-sass +- Docker +- GitHub +- CircleCI +- make +- BuildKit for multiarch container builds -The website uses the following technology: -- bootstrap -- fontawesome -- npm -- browser-sync -- gulp -- dart sass - Initial Setup: ``` npm install browser-sync gulp sass gulp-sass --save-dev