mirror of
https://github.com/pcottle/learnGitBranching.git
synced 2025-06-20 21:35:42 +02:00
add makefile for local docker build
Update readme with info on using docker to build/run app
This commit is contained in:
parent
0df7d3a3dc
commit
b7db714a14
2 changed files with 44 additions and 0 deletions
36
Makefile
Normal file
36
Makefile
Normal file
|
@ -0,0 +1,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'
|
|
@ -102,6 +102,14 @@ Alternatively, you can also build and run the app in a pre-configured online wor
|
|||
|
||||
[](https://gitpod.io/#https://github.com/pcottle/learnGitBranching/blob/main/src/js/git/index.js)
|
||||
|
||||
### Docker
|
||||
|
||||
You can run the most recently built stable image with `docker run -p 8080:80 ghcr.io/pcottle/learngitbranching:main`. Access your environment with at [http://localhost:8080/](<http://localhost:8080/>)
|
||||
|
||||
You can build the app and image with the command: `docker build -t ghcr.io/pcottle/learngitbranching:latest`. See the [Makefile](Makefile) for information on how to build locally with docker.
|
||||
|
||||
|
||||
|
||||
[//]: contributor-faces
|
||||
<a href="https://github.com/pcottle"><img src="https://avatars0.githubusercontent.com/u/1135007?v=4" title="pcottle" width="80" height="80"></a>
|
||||
<a href="https://github.com/Hongarc"><img src="https://avatars1.githubusercontent.com/u/19208123?v=4" title="Hongarc" width="80" height="80"></a>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue