-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
66 lines (55 loc) · 1.46 KB
/
Makefile
File metadata and controls
66 lines (55 loc) · 1.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
.PHONY: all build depends help push run shell test
DOCKER_IMAGE_NAME ?= ghcr.io/gocom/action-textpattern-package-plugin
DOCKER_IMAGE_TAG ?= dev
DOCKER_IMAGE_PLATFORM ?= linux/amd64
RUN = docker run -it --rm --entrypoint=bash -v .:/app "$(DOCKER_IMAGE_NAME):$(DOCKER_IMAGE_TAG)"
BUILD = docker build --platform "$(DOCKER_IMAGE_PLATFORM)" -t "$(DOCKER_IMAGE_NAME):$(DOCKER_IMAGE_TAG)"
all: help
depends:
ifeq ($(DOCKER_IMAGE_NAME),)
@echo "DOCKER_IMAGE_NAME environment variable is required."
@exit 1
endif
build: depends
$(BUILD) .
push: depends
$(BUILD) . --push
run: depends
$(RUN)
shell: depends
$(RUN)
test: depends
ifeq (,$(wildcard .plugin))
git clone https://github.com/gocom/abc_plugin.git .plugin
endif
docker run -it --rm -v .:/app --workdir /app/.plugin "$(DOCKER_IMAGE_NAME):$(DOCKER_IMAGE_TAG)"
help:
@echo "Manage project"
@echo ""
@echo "Usage:"
@echo " $$ make [command] ["
@echo " [DOCKER_IMAGE_NAME=<image>]"
@echo " [DOCKER_IMAGE_TAG=<tag>]"
@echo " [DOCKER_IMAGE_PLATFORM=<platform>]"
@echo " ]"
@echo ""
@echo "Commands:"
@echo ""
@echo " $$ make build"
@echo " Build Docker image"
@echo ""
@echo " $$ make help"
@echo " Print this message"
@echo ""
@echo " $$ make push"
@echo " Build and push Docker image"
@echo ""
@echo " $$ make run"
@echo " Run the built Docker image"
@echo ""
@echo " $$ make shell"
@echo " Log in to the container"
@echo ""
@echo " $$ make test"
@echo " Run smoke test"
@echo ""