Skip to content

Commit 12bf909

Browse files
committed
improve Makefile + README.md
1 parent 07aaacf commit 12bf909

File tree

2 files changed

+45
-24
lines changed

2 files changed

+45
-24
lines changed

Makefile

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,23 @@ serve:
1313
npm install
1414
node build.mjs serve
1515

16-
run: build
16+
docker_run: build
1717
@docker run --name ${NAME} -dt --rm --init -p ${PORT}:3000 ${NAME}:latest > /dev/null
1818
@docker container ls
19-
@echo "🚀 - Running at http://localhost:${PORT}/"
19+
@echo "🚀 - Container '${NAME}' started. Running at http://localhost:${PORT}/"
2020

21-
stop:
21+
docker_stop:
2222
@docker container stop ${NAME} > /dev/null
2323
@echo "☠️ - Container '${NAME}' stopped"
2424

25+
helm_install:
26+
@helm upgrade --install --wait --create-namespace --namespace ${NAME} ${NAME} ./helm
27+
@echo "☸️ - Helm Release '${NAME}' deployed"
28+
29+
helm_uninstall:
30+
@helm uninstall --namespace ${NAME} ${NAME}
31+
@echo "☸️ - Helm Release '${NAME}' uninstalled"
32+
2533
release:
2634
ifeq ($(strip $(version)),)
2735
@echo usage: make release version=v1.0
@@ -31,7 +39,7 @@ else
3139
@echo 🎉 - Release $(version) created $$(git config --get remote.origin.url)
3240
endif
3341

34-
delete_release:
42+
release_delete:
3543
ifeq ($(strip $(version)),)
3644
@echo usage: make delete_release version=v1.0
3745
else

README.md

Lines changed: 33 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,12 @@ Simple WebApp (SPA) using [esbuild](https://esbuild.github.io/), [jsx-dom](https
88
# 📑 Requirements
99
* [NodeJS](https://nodejs.org/) or similar javascript engine
1010
* [Docker](https://www.docker.com/) or similar container engine
11+
* [Helm](https://helm.sh/) for deploying to [Kubernetes](https://kubernetes.io/)
1112

1213
# 🏗️ Structure
13-
All source-files for the app resides in `src` folder.
14-
Where the `src/main/app.jsx` file is your main entry point for `esbuild`.
15-
Any custom css goes into the `app.css` file and any static resource (e.g. html, ico, etc.) goes into the `src/resource` folder. That's all! 😉
14+
All source-files for the app resides in `./src` folder.
15+
Where the `./src/main/app.jsx` file is your main entry point for `esbuild`.
16+
Any custom css goes into the `app.css` file and any static resource (e.g. html, ico, etc.) goes into the `./src/resource` folder. That's all! 😉
1617

1718
# 🛠️ Build App (for Production)
1819
Just run `make` or following commands
@@ -30,41 +31,53 @@ npm install
3031
node build.mjs serve
3132
```
3233

33-
# 🐋 Run Docker App
34-
Just run `make run` or following commands
34+
# 🐋 Docker
35+
## Run Docker Container
36+
Just run `make docker_run` or following command
3537
```
3638
docker run --name ${NAME} -dt --rm --init -p ${PORT}:3000 ${NAME}:latest
3739
```
40+
Alternatively, you can also use `docker compose up` to start the container, by using the `./docker-compose.yaml`.
3841

39-
Alternatively, you can also use `docker compose up` to start the container,
40-
by using the `docker-compose.yaml`.
41-
42-
# 🐋 Stop Docker App
43-
Just run `make stop` or following commands
42+
## Stop Docker Container
43+
Just run `make docker_stop` or following command
4444
```
4545
docker container stop ${NAME}
4646
```
4747

48-
# Run on Kubernetes with Helm
49-
There is also a helm chart provided under `./helm` directory.
48+
Or use `docker compose stop` to stop the container, when using the `./docker-compose.yaml`.
49+
50+
# ☸️ Kubernetes
51+
## Run Kubernetes Pod
52+
There is a helm chart provided under `./helm` directory.
53+
54+
Just run `make helm_install` or following command
55+
```
56+
helm upgrade --install --wait --create-namespace --namespace ${NAME} ${NAME} ./helm
57+
```
5058

59+
## Stop Kubernetes Pod
60+
Just run `make helm_uninstall` or following command
61+
```
62+
helm uninstall --namespace ${NAME} ${NAME}
63+
```
5164

5265
# ⚙️ Github Release + Package
53-
Whenever a commit gets pushed to the `main` branch a workflow gets triggered, which builds the app.
54-
When a commit gets tagged with `v*.*` notation (e.g. `v1.0`) the action created a Github release
55-
and push the Docker Image to the Github Container Registry (ghcr.oi).
66+
Whenever a new commit is pushed on the `main` branch or a pull request is created, the Github workflow gets triggered.
67+
The workflow (`./.github/workflows/buildAndRelease.yaml`) builds the app, Docker image and Helm chart.
68+
69+
To create a Github Release and publish the app, Docker image and Helm chart,
70+
you only have to tag the specific commit with `*.*.*` notation ([SemanticVersion](https://semver.org/)).
5671

57-
Just run `make release version=v1.0` or following commands
72+
Just run `make release version=1.0.0` or following commands
5873
```
5974
git tag v1.0
6075
git push origin tag v1.0
6176
```
6277

6378
It is also possible to delete a release.
64-
Just run `make delete_release version=v1.0` or following commands
79+
Just run `make release_delete version=1.0.0` or following commands
6580
```
6681
git tag -d v1.0
6782
git push --delete origin v1.0
68-
```
69-
70-
# ☸️ Kubernetes
83+
```

0 commit comments

Comments
 (0)