-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathMakefile
More file actions
66 lines (66 loc) · 2.1 KB
/
Makefile
File metadata and controls
66 lines (66 loc) · 2.1 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
# Description: Makefile for the project
# Build targets to build and run the Testcontainers website.
# ------------------------------
# Tools needed:
# - Make
# - Docker
# ------------------------------
# Variables used to configure the build process:
# - NodeJS version, default is 20.3.0
# - Port for the website, default is 1313
# - Community Modules Site PR, default is empty
# - Container name, default is testcontainers-site
# - Hugo version override, default is 0.123.1
# - Community Modules Site path, default is empty, in case you want to use a local version of the community modules site.
NODE_VERSION ?= 20.3.0
PORT ?= 1313
COMMUNITY_MODULE_PR ?=
CONTAINER_NAME ?= testcontainers-site
HUGO_VERSION_OVERRIDE ?= 0.123.1
COMMUNITY_MODULE_PATH ?=
COMMUNITY_MODULE_VOLUME =
ifneq ($(COMMUNITY_MODULE_PATH),)
COMMUNITY_MODULE_VOLUME = -v "$(COMMUNITY_MODULE_PATH):/src/community-module-registry"
endif
# ------------------------------
.PHONY: build
build:
@echo "Building the project..."
docker build --no-cache \
--build-arg "NODE_VERSION=$(NODE_VERSION)" \
--build-arg "COMMUNITY_MODULE_PR=$(COMMUNITY_MODULE_PR)" \
-t testcontainers/site:latest .
# ------------------------------
.PHONY: run
run:
@echo "Running the project..."
@echo "$(COMMUNITY_MODULE_VOLUME)"
@docker run --rm -d \
--name $(CONTAINER_NAME) \
-e "HUGO_VERSION_OVERRIDE=$(HUGO_VERSION_OVERRIDE)" \
-p $(PORT):1313 \
-v "$(CURDIR)/archetypes:/src/archetypes" \
-v "$(CURDIR)/assets:/src/assets" \
-v "$(CURDIR)/content:/src/content" \
-v "$(CURDIR)/data:/src/data" \
-v "$(CURDIR)/layout:/src/layout" \
-v "$(CURDIR)/layouts:/src/layouts" \
-v "$(CURDIR)/static:/src/static" \
$(COMMUNITY_MODULE_VOLUME) \
testcontainers/site:latest
ifeq ($(OS),Windows_NT)
# Windows specific browser open and ignore exit error code 1
-@explorer http://localhost:$(PORT)
else
@open http://localhost:$(PORT)
endif
# ------------------------------
.PHONY: logs
logs:
@docker logs -f $(CONTAINER_NAME)
# ------------------------------
.PHONY: kill
kill:
@echo "Killing the project..."
@docker rm -fv $(CONTAINER_NAME)
# ------------------------------