11# Find documentation in README.md under
22# the heading "Makefile Options".
33
4- OPENWISP_VERSION = 25.10.0
4+ # The .env file can override ?= variables in the Makefile (e.g. OPENWISP_VERSION, IMAGE_OWNER)
5+ include .env
6+
7+ # RELEASE_VERSION: version string used when tagging a new release.
8+ RELEASE_VERSION = 25.10.0
59SHELL := /bin/bash
610.SILENT : clean pull start stop
711
812default : compose-build
913
1014USER = registry.gitlab.com/openwisp/docker-openwisp
1115TAG = edge
16+ # OPENWISP_VERSION: image tag used for pulling/pushing images (e.g. "edge", "latest", "25.10.0")
17+ # Can be overridden via .env or command line. Not the same as RELEASE_VERSION
18+ OPENWISP_VERSION ?= edge
19+ IMAGE_OWNER ?= openwisp
1220SKIP_PULL ?= false
1321SKIP_BUILD ?= false
1422SKIP_TESTS ?= false
1927 for image in ' openwisp-base' ' openwisp-nfs' ' openwisp-api' ' openwisp-dashboard' \
2028 ' openwisp-freeradius' ' openwisp-nginx' ' openwisp-openvpn' ' openwisp-postfix' \
2129 ' openwisp-websocket' ; do \
22- docker pull --quiet $(USER ) /$$ {image}:$(TAG ) ; \
23- docker tag $(USER ) /$$ {image}:$(TAG ) openwisp /$$ {image}:latest ; \
30+ docker pull --quiet $(USER ) /$$ {image}:$(OPENWISP_VERSION ) ; \
31+ docker tag $(USER ) /$$ {image}:$(OPENWISP_VERSION ) $( IMAGE_OWNER ) /$$ {image}:$( OPENWISP_VERSION ) ; \
2432 done
2533
2634# Build
@@ -39,12 +47,12 @@ base-build:
3947 --file ./images/openwisp_base/Dockerfile \
4048 --target PYTHON ./images/ \
4149 $$ BUILD_ARGS; \
42- docker build --tag openwisp /openwisp-base:latest \
50+ docker build --tag $( IMAGE_OWNER ) /openwisp-base:$( OPENWISP_VERSION ) \
4351 --file ./images/openwisp_base/Dockerfile ./images/ \
4452 $$ BUILD_ARGS
4553
4654nfs-build :
47- docker build --tag openwisp /openwisp-nfs:latest \
55+ docker build --tag $( IMAGE_OWNER ) /openwisp-nfs:$( OPENWISP_VERSION ) \
4856 --file ./images/openwisp_nfs/Dockerfile ./images/
4957
5058compose-build : base-build
@@ -72,10 +80,10 @@ clean:
7280 docker compose stop & > /dev/null
7381 docker compose down --remove-orphans --volumes --rmi all & > /dev/null
7482 docker compose rm -svf & > /dev/null
75- docker rmi --force openwisp/openwisp-base:latest \
76- openwisp/openwisp-base:intermedia-system \
83+ docker rmi --force openwisp/openwisp-base:intermedia-system \
7784 openwisp/openwisp-base:intermedia-python \
78- openwisp/openwisp-nfs:latest \
85+ $(IMAGE_OWNER ) /openwisp-base:$(OPENWISP_VERSION ) \
86+ $(IMAGE_OWNER ) /openwisp-nfs:$(OPENWISP_VERSION ) \
7987 ` docker images -f " dangling=true" -q` \
8088 ` docker images | grep openwisp/docker-openwisp | tr -s ' ' | cut -d ' ' -f 3` & > /dev/null
8189
@@ -105,16 +113,13 @@ publish:
105113 for image in ' openwisp-base' ' openwisp-nfs' ' openwisp-api' ' openwisp-dashboard' \
106114 ' openwisp-freeradius' ' openwisp-nginx' ' openwisp-openvpn' ' openwisp-postfix' \
107115 ' openwisp-websocket' ; do \
108- # Docker images built locally are tagged "latest" by default. \
109- # This script updates the tag of each built image to a user-defined tag \
110- # and pushes the newly tagged image to a Docker registry under the user's namespace. \
111- docker tag openwisp/$$ {image}:latest $(USER ) /$$ {image}:$(TAG ) ; \
116+ docker tag $(IMAGE_OWNER ) /$$ {image}:$(OPENWISP_VERSION ) $(USER ) /$$ {image}:$(TAG ) ; \
112117 docker push $(USER ) /$$ {image}:$(TAG ) ; \
113118 if [ " $( TAG) " != " latest" ]; then \
114119 docker rmi $(USER ) /$$ {image}:$(TAG ) ; \
115120 fi ; \
116121 done
117122
118123release :
119- make publish TAG=latest SKIP_TESTS=true
120- make publish TAG=$(OPENWISP_VERSION ) SKIP_BUILD=true SKIP_TESTS=true
124+ make publish TAG=latest OPENWISP_VERSION= $( RELEASE_VERSION ) SKIP_TESTS=true
125+ make publish TAG=$(RELEASE_VERSION ) OPENWISP_VERSION= $( RELEASE_VERSION ) SKIP_BUILD=true SKIP_TESTS=true
0 commit comments