Skip to content

Commit 239df8b

Browse files
committed
Enabling use of podman
1 parent 5a5a5f0 commit 239df8b

2 files changed

Lines changed: 83 additions & 17 deletions

File tree

Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,8 @@ batch-delete-ecr-images: # Mandatory - LIST_OF_DIGESTS: [list of "sha:digest" se
335335

336336
tester-build: ### Build tester docker image
337337
cat $(APPLICATION_DIR)/*/requirements.txt $(APPLICATION_DIR)/requirements-dev.txt | sort --unique > $(DOCKER_DIR)/tester/assets/requirements.txt
338-
make -s docker-image NAME=tester
338+
# make -s docker-image NAME=tester
339+
make -s podman-image NAME=tester
339340

340341
tester-clean:
341342
rm -fv $(DOCKER_DIR)/tester/assets/*.txt

build/automation/lib/docker.mk

Lines changed: 81 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -67,39 +67,41 @@ docker-create-from-template: ### Create Docker image from template - mandatory:
6767
docker-config: ### Configure Docker networking
6868
docker network create $(DOCKER_NETWORK) 2> /dev/null ||:
6969

70-
docker-build docker-image: ### Build Docker image - mandatory: NAME; optional: VERSION,FROM_CACHE=true,BUILD_OPTS=[build options],EXAMPLE=true
70+
######### Trial for podman #############
71+
72+
podman-build podman-image: ### Build Podman image - mandatory: NAME; optional: VERSION, FROM_CACHE=true, BUILD_OPTS=[build options], EXAMPLE=true
7173
reg=$$(make _docker-get-reg)
7274
# Try to execute `make build` from the image directory
73-
if [ -d $(DOCKER_LIB_IMAGE_DIR)/$(NAME) ] && [ -z "$(__DOCKER_BUILD)" ]; then
75+
if [ -d $(DOCKER_LIB_IMAGE_DIR)/$(NAME) ] && [ -z "$(__PODMAN_BUILD)" ]; then
7476
cd $(DOCKER_LIB_IMAGE_DIR)/$(NAME)
75-
make build __DOCKER_BUILD=true DOCKER_REGISTRY=$(DOCKER_LIBRARY_REGISTRY)
77+
make build __PODMAN_BUILD=true PODMAN_REGISTRY=$(PODMAN_LIBRARY_REGISTRY)
7678
exit
77-
elif [ -d $(DOCKER_CUSTOM_DIR)/$(NAME) ] && [ -z "$(__DOCKER_BUILD)" ]; then
79+
elif [ -d $(DOCKER_CUSTOM_DIR)/$(NAME) ] && [ -z "$(__PODMAN_BUILD)" ]; then
7880
cd $(DOCKER_CUSTOM_DIR)/$(NAME)
79-
make build __DOCKER_BUILD=true && exit || cd $(PROJECT_DIR)
80-
elif [ -d $(DOCKER_DIR)/$(NAME) ] && [ -z "$(__DOCKER_BUILD)" ]; then
81+
make build __PODMAN_BUILD=true && exit || cd $(PROJECT_DIR)
82+
elif [ -d $(DOCKER_DIR)/$(NAME) ] && [ -z "$(__PODMAN_BUILD)" ]; then
8183
cd $(DOCKER_DIR)/$(NAME)
82-
make build __DOCKER_BUILD=true && exit || cd $(PROJECT_DIR)
83-
elif [ -d $(DOCKER_DIR)/$(GENERIC_IMAGE_NAME) ] && [ -z "$(__DOCKER_BUILD)" ]; then
84+
make build __PODMAN_BUILD=true && exit || cd $(PROJECT_DIR)
85+
elif [ -d $(DOCKER_DIR)/$(GENERIC_IMAGE_NAME) ] && [ -z "$(__PODMAN_BUILD)" ]; then
8486
cd $(DOCKER_DIR)/$(GENERIC_IMAGE_NAME)
85-
make build __DOCKER_BUILD=true && exit || cd $(PROJECT_DIR)
87+
make build __PODMAN_BUILD=true && exit || cd $(PROJECT_DIR)
8688
fi
87-
# Dockerfile
89+
# Dockerfile (now Podman)
8890
make NAME=$(NAME) \
8991
docker-create-dockerfile FILE=Dockerfile$(shell [ -n "$(EXAMPLE)" ] && echo .example) \
9092
docker-image-set-version VERSION=$(VERSION)
9193
# Cache
9294
cache_from=
9395
if [[ "$(FROM_CACHE)" =~ ^(true|yes|y|on|1|TRUE|YES|Y|ON)$$ ]]; then
94-
make docker-pull NAME=$(NAME) VERSION=latest
96+
make podman-pull NAME=$(NAME) VERSION=latest
9597
cache_from="--cache-from $$reg/$(NAME):latest"
9698
fi
9799
# Build
98100
dir=$$(make _docker-get-dir)
99101
export IMAGE=$$reg/$(NAME)$(shell [ -n "$(EXAMPLE)" ] && echo -example)
100102
export VERSION=$$(make docker-image-get-version)
101103
make -s file-replace-variables FILE=$$dir/Dockerfile.effective
102-
docker buildx build --rm \
104+
podman build --rm \
103105
--build-arg IMAGE=$$IMAGE \
104106
--build-arg VERSION=$$VERSION \
105107
--build-arg BUILD_ID=$(BUILD_ID) \
@@ -108,7 +110,6 @@ docker-build docker-image: ### Build Docker image - mandatory: NAME; optional: V
108110
--build-arg BUILD_BRANCH=$(BUILD_BRANCH) \
109111
--build-arg BUILD_COMMIT_HASH=$(BUILD_COMMIT_HASH) \
110112
--build-arg BUILD_COMMIT_DATE=$(BUILD_COMMIT_DATE) \
111-
--output type=docker \
112113
--label name=$$IMAGE \
113114
--label version=$$VERSION \
114115
--label build-id=$(BUILD_ID) \
@@ -122,12 +123,76 @@ docker-build docker-image: ### Build Docker image - mandatory: NAME; optional: V
122123
--tag $$reg/$(NAME)$(shell [ -n "$(EXAMPLE)" ] && echo -example):$$(make docker-image-get-version) \
123124
$$dir
124125
# Tag
125-
docker tag \
126+
podman tag \
126127
$$reg/$(NAME)$(shell [ -n "$(EXAMPLE)" ] && echo -example):$$(make docker-image-get-version) \
127128
$$reg/$(NAME)$(shell [ -n "$(EXAMPLE)" ] && echo -example):latest
128-
docker rmi --force $$(docker images | grep "<none>" | awk '{ print $$3 }') 2> /dev/null ||:
129+
podman rmi --force $$(podman images | grep "<none>" | awk '{ print $$3 }') 2> /dev/null ||:
129130
make docker-image-keep-latest-only NAME=$(NAME)
130-
docker image inspect $$reg/$(NAME)$(shell [ -n "$(EXAMPLE)" ] && echo -example):latest --format='{{.Size}}'
131+
podman image inspect $$reg/$(NAME)$(shell [ -n "$(EXAMPLE)" ] && echo -example):latest --format='{{.Size}}'
132+
133+
134+
######### Trial for podman #############
135+
# docker-build docker-image: ### Build Docker image - mandatory: NAME; optional: VERSION,FROM_CACHE=true,BUILD_OPTS=[build options],EXAMPLE=true
136+
# reg=$$(make _docker-get-reg)
137+
# # Try to execute `make build` from the image directory
138+
# if [ -d $(DOCKER_LIB_IMAGE_DIR)/$(NAME) ] && [ -z "$(__DOCKER_BUILD)" ]; then
139+
# cd $(DOCKER_LIB_IMAGE_DIR)/$(NAME)
140+
# make build __DOCKER_BUILD=true DOCKER_REGISTRY=$(DOCKER_LIBRARY_REGISTRY)
141+
# exit
142+
# elif [ -d $(DOCKER_CUSTOM_DIR)/$(NAME) ] && [ -z "$(__DOCKER_BUILD)" ]; then
143+
# cd $(DOCKER_CUSTOM_DIR)/$(NAME)
144+
# make build __DOCKER_BUILD=true && exit || cd $(PROJECT_DIR)
145+
# elif [ -d $(DOCKER_DIR)/$(NAME) ] && [ -z "$(__DOCKER_BUILD)" ]; then
146+
# cd $(DOCKER_DIR)/$(NAME)
147+
# make build __DOCKER_BUILD=true && exit || cd $(PROJECT_DIR)
148+
# elif [ -d $(DOCKER_DIR)/$(GENERIC_IMAGE_NAME) ] && [ -z "$(__DOCKER_BUILD)" ]; then
149+
# cd $(DOCKER_DIR)/$(GENERIC_IMAGE_NAME)
150+
# make build __DOCKER_BUILD=true && exit || cd $(PROJECT_DIR)
151+
# fi
152+
# # Dockerfile
153+
# make NAME=$(NAME) \
154+
# docker-create-dockerfile FILE=Dockerfile$(shell [ -n "$(EXAMPLE)" ] && echo .example) \
155+
# docker-image-set-version VERSION=$(VERSION)
156+
# # Cache
157+
# cache_from=
158+
# if [[ "$(FROM_CACHE)" =~ ^(true|yes|y|on|1|TRUE|YES|Y|ON)$$ ]]; then
159+
# make docker-pull NAME=$(NAME) VERSION=latest
160+
# cache_from="--cache-from $$reg/$(NAME):latest"
161+
# fi
162+
# # Build
163+
# dir=$$(make _docker-get-dir)
164+
# export IMAGE=$$reg/$(NAME)$(shell [ -n "$(EXAMPLE)" ] && echo -example)
165+
# export VERSION=$$(make docker-image-get-version)
166+
# make -s file-replace-variables FILE=$$dir/Dockerfile.effective
167+
# docker buildx build --rm \
168+
# --build-arg IMAGE=$$IMAGE \
169+
# --build-arg VERSION=$$VERSION \
170+
# --build-arg BUILD_ID=$(BUILD_ID) \
171+
# --build-arg BUILD_DATE=$(BUILD_DATE) \
172+
# --build-arg BUILD_REPO=$(BUILD_REPO) \
173+
# --build-arg BUILD_BRANCH=$(BUILD_BRANCH) \
174+
# --build-arg BUILD_COMMIT_HASH=$(BUILD_COMMIT_HASH) \
175+
# --build-arg BUILD_COMMIT_DATE=$(BUILD_COMMIT_DATE) \
176+
# --output type=docker \
177+
# --label name=$$IMAGE \
178+
# --label version=$$VERSION \
179+
# --label build-id=$(BUILD_ID) \
180+
# --label build-date=$(BUILD_DATE) \
181+
# --label build-repo=$(BUILD_REPO) \
182+
# --label build-branch=$(BUILD_BRANCH) \
183+
# --label build-commit-hash=$(BUILD_COMMIT_HASH) \
184+
# --label build-commit-date=$(BUILD_COMMIT_DATE) \
185+
# $(BUILD_OPTS) $$cache_from \
186+
# --file $$dir/Dockerfile.effective \
187+
# --tag $$reg/$(NAME)$(shell [ -n "$(EXAMPLE)" ] && echo -example):$$(make docker-image-get-version) \
188+
# $$dir
189+
# # Tag
190+
# docker tag \
191+
# $$reg/$(NAME)$(shell [ -n "$(EXAMPLE)" ] && echo -example):$$(make docker-image-get-version) \
192+
# $$reg/$(NAME)$(shell [ -n "$(EXAMPLE)" ] && echo -example):latest
193+
# docker rmi --force $$(docker images | grep "<none>" | awk '{ print $$3 }') 2> /dev/null ||:
194+
# make docker-image-keep-latest-only NAME=$(NAME)
195+
# docker image inspect $$reg/$(NAME)$(shell [ -n "$(EXAMPLE)" ] && echo -example):latest --format='{{.Size}}'
131196

132197
docker-test: ### Test image - mandatory: NAME; optional: ARGS,CMD,GOSS_OPTS,EXAMPLE=true
133198
dir=$$(make _docker-get-dir)

0 commit comments

Comments
 (0)