Skip to content

Commit 48c5da1

Browse files
authored
Merge pull request #3 from joxz/labels
Labels
2 parents 59829c5 + d13e22f commit 48c5da1

File tree

4 files changed

+44
-23
lines changed

4 files changed

+44
-23
lines changed

.travis.yml

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,10 @@ env:
77
- IMAGE_NAME=jones2748/docker-testcl
88

99
script:
10-
# build latest image always
11-
- docker build --no-cache -t $IMAGE_NAME:latest .
12-
# build the tagged image
13-
#- if [[ $TRAVIS_TAG = $TRAVIS_BRANCH ]]; then docker build -t $IMAGE_NAME:$TRAVIS_BRANCH .; else true ; fi
14-
- docker run -it --rm $IMAGE_NAME test
15-
- docker run -it --rm $IMAGE_NAME test_irule
10+
- make build
11+
- make test
1612

1713
after_script:
1814
- docker images
19-
20-
#after_success:
21-
# - docker login -u="$DOCKERHUB_USER" -p="$DOCKERHUB_PW"
22-
# # push to latest if master branch
23-
# - if [[ $TRAVIS_BRANCH = master ]]; then docker push $IMAGE_NAME:latest; else true; fi
24-
# # push tag as well
25-
# - if [[ $TRAVIS_TAG = $TRAVIS_BRANCH ]]; then docker push $IMAGE_NAME:$TRAVIS_TAG; else true ; fi
15+
- make inspect | jq .
16+
- make history

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ COPY ./test/ /opt/test
2626

2727
FROM adoptopenjdk/openjdk11-openj9:alpine-slim
2828

29-
LABEL maintainer="https://hub.docker.com/u/jones2748"
29+
LABEL maintainer="Johannes Denninger"
3030

3131
ENV TCLLIBPATH=/opt/TesTcl
3232
ENV PATH /opt/jtcl:/opt/test:/app:$PATH

Makefile

Lines changed: 36 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,55 @@
1-
.RECIPEPREFIX +=
1+
DOCKERHUB_USER = jones2748
2+
REPONAME = docker-testcl
3+
DOCKERHUB = $(DOCKERHUB_USER)/$(REPONAME)
4+
GITHUB_USER = joxz
5+
GITHUB = https://github.com/$(GITHUB_USER)/$(REPONAME)
6+
VER = $(shell git rev-parse --short HEAD)
7+
CONTAINERNAME = $(DOCKERHUB):$(VER)
8+
9+
BUILDFLAGS = \
10+
--compress \
11+
--force-rm \
12+
--label org.label-schema.schema-version="1.0" \
13+
--label org.label-schema.description="Docker container for testing iRules with TesTcl" \
14+
--label org.label-schema.vcs-url="$(GITHUB)" \
15+
--label org.label-schema.vcs-ref="$(VER)" \
16+
--label org.label-schema.docker.cmd="docker run -it --rm $(CONTAINERNAME)" \
17+
--label org.label-schema.name="$(DOCKERHUB)" \
18+
--label org.label-schema.build-date="$(shell date -u +"%Y-%m-%dT%H:%M:%SZ")"
219

3-
DOCKERHUB = jones2748/docker-testcl
420

521
default: help
622

723

824
build: ## build container
9-
@docker build -t $(DOCKERHUB) .
25+
@docker build $(BUILDFLAGS) -t $(CONTAINERNAME) .
1026

1127
build-no-cache: ## build container without cache
12-
@docker build --no-cache -t $(DOCKERHUB) .
28+
@docker build --no-cache $(BUILDFLAGS) -t $(CONTAINERNAME) .
1329

1430
run: ## run container
15-
@docker run -it --rm $(DOCKERHUB)
31+
@docker run -it --rm $(CONTAINERNAME)
1632

1733
clean: ## remove images
18-
@docker rmi $(DOCKERHUB)
34+
@docker rmi $(CONTAINERNAME)
35+
36+
.PHONY: inspect
37+
inspect: ## inspect container properties - pretty: 'make inspect | jq .' requires jq
38+
@docker inspect -f "{{json .ContainerConfig }}" $(CONTAINERNAME)
1939

2040
.PHONY: test
2141
test: ## test container with builtin tests
22-
docker run -it --rm $(DOCKERHUB) test
23-
docker run -it --rm $(DOCKERHUB) test_irule
42+
docker run -it --rm $(CONTAINERNAME) test
43+
docker run -it --rm $(CONTAINERNAME) test_irule
44+
45+
.PHONY: logs
46+
logs: ## show docker logs for container (ONLY possible while container is running)
47+
@docker logs -f $(CONTAINERNAME)
2448

49+
.PHONY: history
50+
history: ## show docker history for container
51+
@docker history $(CONTAINERNAME)
2552

2653
.PHONY: help
2754
help: ## this help
28-
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
55+
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,11 @@ build build container
100100
build-no-cache build container without cache
101101
clean remove images
102102
help this help
103+
inspect inspect container properties - pretty: 'make inspect | jq .' requires jq
104+
logs show docker logs for container (ONLY possible while container is running)
103105
run run container
104106
test test container with builtin tests
107+
105108
```
106109

107110
## TODO

0 commit comments

Comments
 (0)