Skip to content

Commit 23604a0

Browse files
author
Laurent Gougeon
committed
Improvements.
1 parent 5fd5b2a commit 23604a0

File tree

5 files changed

+35
-22
lines changed

5 files changed

+35
-22
lines changed

Makefile

+16-12
Original file line numberDiff line numberDiff line change
@@ -36,25 +36,25 @@ DOCKER_VERSION = $(shell $(DOCKER) --version)
3636

3737
# Default target
3838
.PHONY: help
39-
help: ## Show this help message (*=outside **=inside the dev-container)
39+
help: ## Show this help message (*=outside **=inside the development container)
4040
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf "\033[36m%-12s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST)
4141

42-
# Common function to check if inside or outside the dev-container
42+
# Common function to check if inside or outside the development container
4343
check-container-state = \
4444
if [ "$$IN_DEV_CONTAINER" = "$(1)" ]; then \
45-
printf "$(RED)Error: This target can only be run $(2) the dev-container$(RESET)\n"; \
45+
printf "$(RED)Error: This target can only be run $(2) the development container$(RESET)\n"; \
4646
exit 1; \
4747
fi
4848

4949
# Conditional targets based on the environment
50-
.PHONY: dev dev-cntnr run login rm-cntnr rm-image get-geodb build clean info
51-
dev: dev-cntnr run login ## Build, run and login into the dev-container (*)
50+
.PHONY: dev .dev-cntnr run login .rm-cntnr rm-dev get-geodb get-licenses build clean info
51+
dev: .dev-cntnr .run login ## Build, run and login into the development container (*)
5252

53-
dev-cntnr: ## Build the dev-container (*)
53+
.dev-cntnr: ## Build the development container (*)
5454
@$(call check-container-state,true,outside)
5555
cd .devcontainer && $(DOCKER) build -f Dockerfile -t $(IMAGE_NAME) .
5656

57-
run: ## Run the dev-container (*)
57+
run: ## Run the development container (*)
5858
@$(call check-container-state,true,outside)
5959
@$(DOCKER) run -d \
6060
-v /var/run/docker.sock:/var/run/docker.sock \
@@ -65,16 +65,16 @@ run: ## Run the dev-container (*)
6565
$(IMAGE_NAME) \
6666
sleep infinity
6767

68-
login: ## Login into the running dev-container (*)
68+
login: ## Log in to the running development container (*)
6969
@$(call check-container-state,true,outside)
7070
@$(DOCKER) exec -it -w $(WORKDIR) $(CONTAINER_NAME) /bin/bash
7171

72-
rm-cntnr: ## Stop and remove the dev-container (*)
72+
.rm-cntnr: ## Stop and remove the development container (*)
7373
@$(call check-container-state,true,outside)
7474
@$(DOCKER) stop $(CONTAINER_NAME) || true
7575
@$(DOCKER) rm $(CONTAINER_NAME) || true
7676

77-
rm-image: ## Remove the dev-image (*)
77+
rm-dev: .rm-cntnr ## Stop the development container, then remove both its container and image. (*)
7878
@$(call check-container-state,true,outside)
7979
@$(DOCKER) rmi -f $(IMAGE_NAME) || exit 1
8080

@@ -83,6 +83,10 @@ get-geodb: ## Fetch latest GeoLite2-City (MaxMind.com) CDN files
8383
wget -qO- https://cdn.jsdelivr.net/npm/geolite2-city/GeoLite2-City.mmdb.gz | \
8484
gunzip -c > etc/master/conf/GeoLite2-City.mmdb
8585

86+
get-licenses: ## Fetch license information for all dependencies (**)
87+
@$(call check-container-state,"",inside)
88+
@mvn license:download-licenses
89+
8690
build: ## Compile java sources into JARs, create RPMs and Docker images (**)
8791
@$(call check-container-state,"",inside)
8892
@mvn package
@@ -97,9 +101,9 @@ clean: ## Stop containers, remove images, JARs, RPMs and dependencies (**)
97101

98102
info: ## Output the configuration
99103
@if [ -n "$(IN_DEV_CONTAINER)" ]; then \
100-
printf "$(GREEN)** You are INSIDE the dev-container **$(RESET)\n"; \
104+
printf "$(GREEN)** You are INSIDE the development container **$(RESET)\n"; \
101105
else \
102-
printf "$(RED)** You are OUTSIDE the dev-container **$(RESET)\n"; \
106+
printf "$(RED)** You are OUTSIDE the development container **$(RESET)\n"; \
103107
fi
104108
@echo "Software tag number: $(TAG)"
105109
@echo "Docker host/current OS: $(DOCKER_HOST_OS)/$(DOCKER_GUEST_OS)"

docker/Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ build: .https-access ## Build database, Java, and service images
6262
@$(MAKE) .build app=monitor tag=$(TAG)
6363

6464
.build: # Build the image (args: app, tag)
65-
$(DOCKER) build $(BUILD_OPTS) --label "app=$(app)" --label "tag=$(tag)" -t ecpds/$(app):$(tag) ecpds/$(app)
65+
$(DOCKER) build $(BUILD_OPTS) --build-arg TAG=$(tag) --label "app=$(app)" --label "tag=$(tag)" -t ecpds/$(app):$(tag) ecpds/$(app)
6666

6767
images: ## List images
6868
@$(DOCKER) images --format "{{.ID}}@{{.Repository}}:{{.Tag}}" | grep 'ecpds/$(app)' | grep ':$(tag)' | awk -F'[@/]' '{print $$1 "@" $$(NF-1)":"$$NF}' | sed 's/:/-/g' | egrep -v '\-latest$$' | uniq

docker/ecpds/master/Dockerfile

+6-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
ARG BUILDPLATFORM=linux/amd64
22
FROM --platform=${BUILDPLATFORM} ecpds/java:openjdk-23.0.0
33

4+
ARG TAG
5+
ENV TAG=${TAG}
6+
47
LABEL maintainer="[email protected]"
58

69
# Container specific
@@ -33,11 +36,11 @@ ENV LOG_ROLLOVER_DATE_KEEP=10d
3336
ENV LOG_LEVEL=warn
3437

3538
# Add OpenECPDS rpms
36-
COPY rpms/ecpds-master-*.noarch.rpm .
39+
COPY rpms/ecpds-master-${TAG}.noarch.rpm .
3740

3841
# Install OpenECPDS rpms
39-
RUN yum install -d1 -y ecpds-master-*.noarch.rpm && \
40-
yum clean all && rm -f ecpds-*.rpm
42+
RUN yum install -d1 -y ecpds-master-${TAG}.noarch.rpm && \
43+
yum clean all && rm -f ecpds-master-${TAG}.noarch.rpm
4144

4245
# Mountable volumes
4346
VOLUME /var/log/ecpds/master

docker/ecpds/monitor/Dockerfile

+6-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
ARG BUILDPLATFORM=linux/amd64
22
FROM --platform=${BUILDPLATFORM} ecpds/java:openjdk-23.0.0
33

4+
ARG TAG
5+
ENV TAG=${TAG}
6+
47
LABEL maintainer="[email protected]"
58

69
# Container specific
@@ -28,11 +31,11 @@ ENV LOG_ROLLOVER_SIZE_KEEP=20
2831
ENV LOG_LEVEL=warn
2932

3033
# Add OpenECPDS rpms
31-
COPY rpms/ecpds-monitor-*.noarch.rpm .
34+
COPY rpms/ecpds-monitor-${TAG}.noarch.rpm .
3235

3336
# Install OpenECPDS rpms
34-
RUN yum install -d1 -y ecpds-monitor-*.noarch.rpm && \
35-
yum clean all && rm -f ecpds-*.rpm
37+
RUN yum install -d1 -y ecpds-monitor-${TAG}.noarch.rpm && \
38+
yum clean all && rm -f ecpds-monitor-${TAG}.noarch.rpm
3639

3740
# Mountable volumes
3841
VOLUME /var/log/ecpds/monitor

docker/ecpds/mover/Dockerfile

+6-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
ARG BUILDPLATFORM=linux/amd64
22
FROM --platform=${BUILDPLATFORM} ecpds/java:openjdk-23.0.0
33

4+
ARG TAG
5+
ENV TAG=${TAG}
6+
47
LABEL maintainer="[email protected]"
58

69
# Container specific
@@ -31,12 +34,12 @@ ENV LOG_ROLLOVER_SIZE_KEEP=20
3134
ENV LOG_LEVEL=warn
3235

3336
# Add OpenECPDS rpms
34-
COPY rpms/ecpds-mover-*.noarch.rpm .
37+
COPY rpms/ecpds-mover-${TAG}.noarch.rpm .
3538

3639
# Install OpenECPDS rpms and lbzip2
3740
RUN yum install -d1 -y lbzip2 && \
38-
yum install -d1 -y ecpds-mover-*.noarch.rpm && \
39-
yum clean all && rm -f ecpds-*.rpm
41+
yum install -d1 -y ecpds-mover-${TAG}.noarch.rpm && \
42+
yum clean all && rm -f ecpds-mover-${TAG}.noarch.rpm
4043

4144
# Mountable volumes
4245
VOLUME /var/log/ecpds/mover

0 commit comments

Comments
 (0)