Skip to content

Commit

Permalink
Merge pull request #4 from IamMrCupp:dev
Browse files Browse the repository at this point in the history
Update Makefile for Docker Image Creation
  • Loading branch information
IamMrCupp authored Jul 20, 2021
2 parents f2ac4b8 + f6879c4 commit db288ae
Show file tree
Hide file tree
Showing 3 changed files with 141 additions and 32 deletions.
123 changes: 107 additions & 16 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -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:
- /.*/
15 changes: 10 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,19 @@ 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
###############################################################################
# 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
Expand Down Expand Up @@ -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
Expand Down
35 changes: 24 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit db288ae

Please sign in to comment.