forked from pcottle/learnGitBranching
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
36 lines (28 loc) · 1.11 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
ifeq ($(OS),Windows_NT)
SHELL := pwsh.exe
else
SHELL := pwsh
endif
.SHELLFLAGS := -NoProfile -Command
REGISTRY_NAME := ghcr.io/
REPOSITORY_NAME := pcottle/
IMAGE_NAME := learngitbranching
TAG := :latest
.PHONY: all clean test
all: build
getcommitid:
$(eval COMMITID = $(shell git log -1 --pretty=format:'%H'))
getbranchname:
$(eval BRANCH_NAME = $(shell (git branch --show-current ) -replace '/','.'))
build:
docker run --rm -v $${PWD}:/mnt --workdir /mnt node:14.20.0-alpine3.16 yarn install
docker run --rm -v $${PWD}:/mnt --workdir /mnt node:14.20.0-alpine3.16 yarn gulp fastBuild
build_docker: getcommitid getbranchname
docker build -t $(REGISTRY_NAME)$(REPOSITORY_NAME)$(IMAGE_NAME)$(TAG) -t $(REGISTRY_NAME)$(REPOSITORY_NAME)$(IMAGE_NAME):$(BRANCH_NAME) -t $(REGISTRY_NAME)$(REPOSITORY_NAME)$(IMAGE_NAME):$(BRANCH_NAME)_$(COMMITID) .
docker build --target export --output type=local,dest=learnGitBranching_$(BRANCH_NAME)_$(COMMITID) .
run:
docker run -p 8080:80 $(REGISTRY_NAME)$(REPOSITORY_NAME)$(IMAGE_NAME)$(TAG)
clean:
echo 'not implemented'
test:
echo 'not implemented'