Skip to content

Commit

Permalink
make: docker-build-log task creates log file for diagnosis
Browse files Browse the repository at this point in the history
Docker has a collapsed view of the build output when run on the command line

`make docker-build-log` builds the service and creates a time-stamped log file of docker output
  • Loading branch information
practicalli-johnny committed Apr 28, 2024
1 parent a1f5a88 commit ff78c00
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 9 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ All notable changes to this project will be documented in this file. This change
## Changed
- security: update to clojure 1.11.2
- library: update tools.build to 0.10.0 - caches correctly in docker
- make: docker-build-log task to create log file of all docker output for diagnosis

# 2024-04-08

Expand Down
6 changes: 6 additions & 0 deletions resources/practicalli/application/root/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ MEGALINTER_RUNNER = npx mega-linter-runner --flavor java --env "'MEGALINTER_CONF
CLOJURE_TEST_RUNNER = clojure -M:test/env:test/run
CLOJURE_EXEC_TEST_RUNNER = clojure -X:test/env:test/run

DOCKER-BUILD-LOGFILE := docker-build-log-$(shell date +%y-%m-%d-%T).org

# Makefile file and directory name wildcard
# EDN-FILES := $(wildcard *.edn)
# ------------------------------------ #
Expand Down Expand Up @@ -137,6 +139,10 @@ docker-build: ## Build Clojure project and run with docker compose
$(info --------- Docker Compose Build ---------)
docker compose up --build --detach

docker-build-log: ## Build Clojure project and run with docker compose - log to file
$(info --------- Docker Compose Build ---------)
docker compose up --build --detach &> $(DOCKER-BUILD-LOGFILE) | tee $(DOCKER-BUILD-LOGFILE)

docker-build-clean: ## Build Clojure project and run with docker compose, removing orphans
$(info --------- Docker Compose Build - remove orphans ---------)
docker compose up --build --remove-orphans --detach
Expand Down
6 changes: 6 additions & 0 deletions resources/practicalli/landing_page/root/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ MEGALINTER_RUNNER = npx mega-linter-runner --flavor java --env "'MEGALINTER_CONF
CLOJURE_TEST_RUNNER = clojure -M:test/env:test/run
CLOJURE_EXEC_TEST_RUNNER = clojure -X:test/env:test/run

DOCKER-BUILD-LOGFILE := docker-build-log-$(shell date +%y-%m-%d-%T).org

# Makefile file and directory name wildcard
# EDN-FILES := $(wildcard *.edn)
# ------------------------------------ #
Expand Down Expand Up @@ -151,6 +153,10 @@ docker-build: ## Build Clojure project and run with docker compose
$(info --------- Docker Compose Build ---------)
docker compose up --build --detach

docker-build-log: ## Build Clojure project and run with docker compose - log to file
$(info --------- Docker Compose Build ---------)
docker compose up --build --detach &> $(DOCKER-BUILD-LOGFILE) | tee $(DOCKER-BUILD-LOGFILE)

docker-build-clean: ## Build Clojure project and run with docker compose, removing orphans
$(info --------- Docker Compose Build - remove orphans ---------)
docker compose up --build --remove-orphans --detach
Expand Down
14 changes: 10 additions & 4 deletions resources/practicalli/minimal/root/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ MEGALINTER_RUNNER = npx mega-linter-runner --flavor java --env "'MEGALINTER_CONF
CLOJURE_TEST_RUNNER = clojure -M:test/env:test/run
CLOJURE_EXEC_TEST_RUNNER = clojure -X:test/env:test/run

DOCKER-BUILD-LOGFILE := docker-build-log-$(shell date +%y-%m-%d-%T).org

# Makefile file and directory name wildcard
# EDN-FILES := $(wildcard *.edn)
# ------------------------------------ #
Expand Down Expand Up @@ -93,19 +95,19 @@ test-watch-all: ## Run all tests when changes saved, regardless of failing test
# -------- Build tasks --------------- #
build-config: ## Pretty print build configuration
$(info --------- View current build config ---------)
clojure -T:build config
clojure -T:build/task config

build-jar: ## Build a jar archive of Clojure project
$(info --------- Build library jar ---------)
clojure -T:build jar
clojure -T:build/task jar

build-uberjar: ## Build a uberjar archive of Clojure project & Clojure runtime
$(info --------- Build service Uberjar ---------)
clojure -T:build uberjar
clojure -T:build/task uberjar

build-clean: ## Clean build assets or given directory
$(info --------- Clean Build ---------)
clojure -T:build clean
clojure -T:build/task clean
# ------------------------------------ #

# ------- Code Quality --------------- #
Expand Down Expand Up @@ -137,6 +139,10 @@ docker-build: ## Build Clojure project and run with docker compose
$(info --------- Docker Compose Build ---------)
docker compose up --build --detach

docker-build-log: ## Build Clojure project and run with docker compose - log to file
$(info --------- Docker Compose Build ---------)
docker compose up --build --detach &> $(DOCKER-BUILD-LOGFILE) | tee $(DOCKER-BUILD-LOGFILE)

docker-build-clean: ## Build Clojure project and run with docker compose, removing orphans
$(info --------- Docker Compose Build - remove orphans ---------)
docker compose up --build --remove-orphans --detach
Expand Down
16 changes: 11 additions & 5 deletions resources/practicalli/service/root/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ MEGALINTER_RUNNER = npx mega-linter-runner --flavor java --env "'MEGALINTER_CONF
CLOJURE_TEST_RUNNER = clojure -M:test/env:test/run
CLOJURE_EXEC_TEST_RUNNER = clojure -X:test/env:test/run

DOCKER-BUILD-LOGFILE := docker-build-log-$(shell date +%y-%m-%d-%T).org

# Makefile file and directory name wildcard
# EDN-FILES := $(wildcard *.edn)
# ------------------------------------ #
Expand All @@ -56,7 +58,7 @@ run: ## Run Service using clojure.main

deps: deps.edn ## Prepare dependencies for test and dist targets
$(info --------- Download test and service libraries ---------)
clojure -P -X:build
clojure -P -M:test/run && clojure -P -T:build/task

dist: build-uberjar ## Build and package Clojure service
$(info --------- Build and Package Clojure service ---------)
Expand Down Expand Up @@ -97,19 +99,19 @@ test-watch-all: ## Run all tests when changes saved, regardless of failing test
# -------- Build tasks --------------- #
build-config: ## Pretty print build configuration
$(info --------- View current build config ---------)
clojure -T:build config
clojure -T:build/task config

build-jar: ## Build a jar archive of Clojure project
$(info --------- Build library jar ---------)
clojure -T:build jar
clojure -T:build/task jar

build-uberjar: ## Build a uberjar archive of Clojure project & Clojure runtime
$(info --------- Build service Uberjar ---------)
clojure -T:build uberjar
clojure -T:build/task uberjar

build-clean: ## Clean build assets or given directory
$(info --------- Clean Build ---------)
clojure -T:build clean
clojure -T:build/task clean
# ------------------------------------ #

# ------- Code Quality --------------- #
Expand Down Expand Up @@ -141,6 +143,10 @@ docker-build: ## Build Clojure project and run with docker compose
$(info --------- Docker Compose Build ---------)
docker compose up --build --detach

docker-build-log: ## Build Clojure project and run with docker compose - log to file
$(info --------- Docker Compose Build ---------)
docker compose up --build --detach &> $(DOCKER-BUILD-LOGFILE) | tee $(DOCKER-BUILD-LOGFILE)

docker-build-clean: ## Build Clojure project and run with docker compose, removing orphans
$(info --------- Docker Compose Build - remove orphans ---------)
docker compose up --build --remove-orphans --detach
Expand Down

0 comments on commit ff78c00

Please sign in to comment.