-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathMakefile
59 lines (50 loc) · 1.83 KB
/
Makefile
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
SNAME ?= theia
RNAME ?= elswork/$(SNAME)
VER ?= `cat VERSION`
BASE ?= latest
BASENAME ?= node:12.22.7-alpine
TARGET_PLATFORM ?= linux/amd64,linux/arm64
NO_CACHE ?=
# NO_CACHE ?= --no-cache
# linux/amd64,linux/arm64,linux/ppc64le,linux/s390x,linux/386,linux/arm/v7,linux/arm/v6
# HELP
# This will output the help for each task
.PHONY: help
help: ## This help.
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST)
.DEFAULT_GOAL := help
# DOCKER TASKS
# Build image
debug: ## Debug the container
docker build -t $(RNAME):debug \
--build-arg BASEIMAGE=$(BASENAME) \
--build-arg VERSION=$(VER) .
build: ## Build the container
docker build $(NO_CACHE) -t $(RNAME):$(VER) -t $(RNAME):latest \
--build-arg BUILD_DATE=`date -u +"%Y-%m-%dT%H:%M:%SZ"` \
--build-arg BASEIMAGE=$(BASENAME) \
--build-arg VERSION=$(VER) .
bootstrap: ## Start multicompiler
docker buildx inspect --bootstrap
debugx: ## Buildx in Debug mode
docker buildx build \
--platform ${TARGET_PLATFORM} \
-t $(RNAME):debug --pull \
--build-arg BASEIMAGE=$(BASENAME) \
--build-arg VERSION=$(VER) .
buildx: ## Buildx the container
docker buildx build $(NO_CACHE) \
--platform ${TARGET_PLATFORM} \
-t ghcr.io/$(RNAME):$(VER) -t ghcr.io/$(RNAME):latest \
-t $(RNAME):$(VER) -t $(RNAME):latest --pull --push \
--build-arg BUILD_DATE=`date -u +"%Y-%m-%dT%H:%M:%SZ"` \
--build-arg VCS_REF=`git rev-parse --short HEAD` \
--build-arg BASEIMAGE=$(BASENAME) \
--build-arg VERSION=$(VER) .
# Operations
console: ## Start console in container
docker run -it --rm --entrypoint "/bin/ash" $(RNAME):$(VER)
startdebug: ## Start a Theia in a debug container
docker run -it -p 3000:3000 --rm -v "$(CURDIR):/home/project:cached" $(RNAME):debug
start: ## Start Theia IDE
docker run -d -p 3000:3000 -v "$(CURDIR):/home/project:cached" $(RNAME)