Skip to content

Commit

Permalink
Refactor Makefile and README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
ErdemOzgen committed Apr 1, 2024
1 parent 6007ea0 commit 242c9e4
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 18 deletions.
37 changes: 23 additions & 14 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,27 +21,36 @@ BLACKCART_LATEST_IMAGE_NAME := $(REGISTRY)/$(DOCKER_USERNAME)/$(BLACKCART_IMAGE_

# Default target
.PHONY: all
all: build-blackarch push-blackarch
all: check-builder build-blackarch push-images

# Create Buildx builder
.PHONY: create-builder
create-builder:
-docker buildx create --name $(BUILDER_NAME) --use

# BlackArch Image Targets
# Check if Buildx builder exists, create if not
.PHONY: check-builder
check-builder:
@if ! docker buildx ls | grep -q $(BUILDER_NAME); then \
docker buildx create --name $(BUILDER_NAME) --use; \
else \
docker buildx use $(BUILDER_NAME); \
fi

# BlackArch Image Target
.PHONY: build-blackarch
build-blackarch: create-builder
build-blackarch:
@echo "Building BlackArch image $(BLACKCART_FULL_IMAGE_NAME)"
docker buildx build --platform linux/amd64,linux/arm64 -t $(BLACKCART_FULL_IMAGE_NAME) --push .
@echo "Tagging BlackArch image as latest"
docker buildx build --platform linux/amd64,linux/arm64 -t $(BLACKCART_LATEST_IMAGE_NAME) --push .
# Tag the built image as latest - This step is not needed with --push, but kept for reference
# .PHONY: tag-latest
# tag-latest:
# @echo "Tagging $(BLACKCART_FULL_IMAGE_NAME) as latest"
# docker tag $(BLACKCART_FULL_IMAGE_NAME) $(BLACKCART_LATEST_IMAGE_NAME)

.PHONY: push-blackarch
push-blackarch:
@echo "Pushing BlackArch images"
docker push $(BLACKCART_FULL_IMAGE_NAME)
docker push $(BLACKCART_LATEST_IMAGE_NAME)
# Push both tags to Docker Hub - This step is covered by --push in build-blackarch
.PHONY: push-images
push-images:
@echo "Pushing images to Docker Hub"
# These commands are not needed because --push in the build step does the job
# docker push $(BLACKCART_FULL_IMAGE_NAME)
# docker push $(BLACKCART_LATEST_IMAGE_NAME)

# Login to Docker Hub
.PHONY: login
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@

<p align="center"><a href="https://github.com/ErdemOzgen/blackcart">Blackcart</a> - Continuous Automated Red Teaming/DevSecOps Dockerfile</p>
<p align="center">
<a href="https://github.com/erdemozgen/blackcart/actions/workflows/build-and-push.yaml" alt="Publish Docker Image">
<img src="https://img.shields.io/github/actions/workflow/status/erdemozgen/blackcart/build-and-push.yaml" /></a>
<!-- <a href="https://github.com/erdemozgen/blackcart/actions/workflows/build-and-push.yaml" alt="Publish Docker Image">
<img src="https://img.shields.io/github/actions/workflow/status/erdemozgen/blackcart/build-and-push.yaml" /></a> -->
<a href="http://doge.mit-license.org" alt="License">
<img src="http://img.shields.io/:license-mit-blue.svg" /></a>
<a href="https://hub.docker.com/r/erdemozgen/blackcart/" alt="Docker image size">
<img src="https://img.shields.io/docker/image-size/erdemozgen/blackcart/latest" /></a>
<a href="https://hub.docker.com/r/erdemozgen/blackcart/" alt="Docker Pulls">
<img src="https://img.shields.io/docker/pulls/erdemozgen/blackcart" /></a>
<a href="https://www.codefactor.io/repository/github/erdemozgen/blackcart/overview/main"><img src="https://www.codefactor.io/repository/github/erdemozgen/blackcart/badge/main" alt="CodeFactor" /></a>
<a href="https://github.com/ErdemOzgen/blackcart/actions/workflows/build-and-push.yaml/badge.svg"><img src="https://github.com/ErdemOzgen/blackcart/actions/workflows/build-and-push.yaml/badge.svg" alt="Build and Push Docker Image" /></a>
<a href="https://github.com/ErdemOzgen/blackcart/actions/workflows/docker-publish.yml/badge.svg"><img src="https://github.com/ErdemOzgen/blackcart/actions/workflows/docker-publish.yml/badge.svg" alt="Docker" /></a>
<!-- <a href="https://github.com/ErdemOzgen/blackcart/actions/workflows/build-and-push.yaml/badge.svg"><img src="https://github.com/ErdemOzgen/blackcart/actions/workflows/build-and-push.yaml/badge.svg" alt="Build and Push Docker Image" /></a> -->
<!-- <a href="https://github.com/ErdemOzgen/blackcart/actions/workflows/docker-publish.yml/badge.svg"><img src="https://github.com/ErdemOzgen/blackcart/actions/workflows/docker-publish.yml/badge.svg" alt="Docker" /></a> -->
</p>

# Blackcart
Expand Down

0 comments on commit 242c9e4

Please sign in to comment.