homepage/docker/server/Makefile
Tom Alexander 8b6836ffd9
Switch to encoding the full build process in the Dockerfile.
New features added in buildkit enable us to encode the full build process in the Dockerfile which makes tekton no longer a hard dependency for building the homepage.
2024-10-20 19:09:03 -04:00

53 lines
1.4 KiB
Makefile

SHELL := bash
.ONESHELL:
.SHELLFLAGS := -eu -o pipefail -c
.DELETE_ON_ERROR:
MAKEFLAGS += --warn-undefined-variables
MAKEFLAGS += --no-builtin-rules
OS:=$(shell uname -s)
ifeq ($(origin .RECIPEPREFIX), undefined)
$(error This Make does not support .RECIPEPREFIX. Please use GNU Make 4.0 or later)
endif
.RECIPEPREFIX = >
IMAGE_NAME:=homepage
# REMOTE_REPO:=harbor.fizz.buzz/private
TARGET :=
.PHONY: help
help:
> @grep -h "##" $(MAKEFILE_LIST) | grep -v grep | sed -E 's/^([^:]*): *## */\1: /'
.PHONY: build
build: ## Build the docker image.
> docker build --ssh default --tag $(IMAGE_NAME) --target=$(TARGET) --file Dockerfile ../../
.PHONY: push
push: ## Push the docker image to a remote repository.
ifdef REMOTE_REPO
> docker tag $(IMAGE_NAME) $(REMOTE_REPO)/$(IMAGE_NAME)
> docker push $(REMOTE_REPO)/$(IMAGE_NAME)
else
> @echo "REMOTE_REPO not defined, not pushing to a remote repo."
endif
.PHONY: clean
clean:
> docker rmi $(IMAGE_NAME)
ifdef REMOTE_REPO
> docker rmi $(REMOTE_REPO)/$(IMAGE_NAME)
else
> @echo "REMOTE_REPO not defined, not removing from remote repo."
endif
.PHONY: run
run: build
run: ## Launch the docker image
> docker run --rm -i -t -p "8080:8080" $(IMAGE_NAME)
.PHONY: shell
shell: ## Launch an interactive shell inside the docker image.
shell: build
> docker run --rm -i -t -p "8080:8080" --entrypoint /bin/bash --mount type=tmpfs,destination=/tmp $(IMAGE_NAME)