-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add express server which runs Makefile targets
- Loading branch information
1 parent
42a0ad4
commit b683565
Showing
8 changed files
with
3,675 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# EditorConfig is awesome: http://EditorConfig.org | ||
|
||
root = true | ||
|
||
[*] | ||
end_of_line = lf | ||
insert_final_newline = true | ||
trim_trailing_whitespace = true | ||
|
||
[*.{json,js,html,css,yml}] | ||
indent_style = space | ||
indent_size = 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"extends": ["airbnb-base", "plugin:prettier/recommended"], | ||
"env": { | ||
"node": true, | ||
"es6": true, | ||
"jest": true | ||
}, | ||
"parserOptions": { | ||
"ecmaVersion": 2018 | ||
}, | ||
"rules": { | ||
"no-console": "off", | ||
"no-underscore-dangle": "off" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
FROM alpine:3.9 as build | ||
|
||
RUN apk add --no-cache make nodejs npm | ||
|
||
WORKDIR /root | ||
COPY package*.json ./ | ||
RUN npm install | ||
|
||
COPY src /root/src | ||
EXPOSE 3000 | ||
CMD ["npm", "start"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
REGISTRY_HOST = docker.io | ||
USERNAME = expelledboy | ||
NAME = $(shell basename $(CURDIR)) | ||
IMAGE = $(REGISTRY_HOST)/$(USERNAME)/$(NAME) | ||
|
||
.EXPORT_ALL_VARIABLES: | ||
.DEFAULT: help | ||
|
||
## == | ||
.PHONY: help build lint unit test clean | ||
|
||
help: ## Print help messages | ||
@sed -n 's/^\([a-zA-Z_-]*\):.*## \(.*\)$$/\1 -- \2/p' Makefile | ||
|
||
build: ## Build docker image | ||
docker build -t $(IMAGE) . | ||
|
||
test: ## Run simple unit test | ||
docker run -d --rm \ | ||
--name $(NAME) \ | ||
-v $(PWD):/webhook/ \ | ||
-p 3000:3000 \ | ||
$(IMAGE) | ||
sleep 5 | ||
-curl http://localhost:3000/help | ||
docker stop $(NAME) | ||
|
||
# == | ||
.PHONY: on-tag bump publish | ||
|
||
on-tag: | ||
@git describe --exact-match --tags $$(git log -n1 --pretty='%h') | ||
|
||
bump-package: IMPACT = patch | ||
bump-package: | ||
npm version $(IMPACT) | ||
|
||
bump: VERSION = $(shell node -p "require('./package.json').version") | ||
bump: bump-package ## Bump release version eg. `make IMPACT=patch bump` | ||
git add package.json | ||
git commit -m 'Release version $(VERSION)' | ||
git tag $(VERSION) | ||
|
||
publish: VERSION = $(shell git describe --always) | ||
publish: on-tag build ## Push docker image to $(REGISTRY_HOST) | ||
echo docker push $(IMAGE):$(VERSION) | ||
echo docker push $(IMAGE):latest | ||
|
||
# == |
Oops, something went wrong.