[projects/cleanbuild] Create container with docker-compose

glen glen at pld-linux.org
Thu Apr 1 13:33:11 CEST 2021


commit ebceaeef21dc503a366cf958048968fdf1e47ba3
Author: Elan Ruusamäe <glen at pld-linux.org>
Date:   Thu Mar 11 00:45:27 2021 +0200

    Create container with docker-compose
    
    Using docker compose is more easier to do overrides
    using docker-compose.override.yml file.

 .gitignore               |  1 +
 bin/cleanbuild-docker.sh | 18 +++++++-----------
 docker-compose.yml       | 15 +++++++++++++++
 3 files changed, 23 insertions(+), 11 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index a8d188c..6db5acf 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,3 +2,4 @@
 *.sw[o-p]
 /cache/
 /rpm/
+/docker-compose.override.yml
diff --git a/bin/cleanbuild-docker.sh b/bin/cleanbuild-docker.sh
index b7259fc..d0f9747 100755
--- a/bin/cleanbuild-docker.sh
+++ b/bin/cleanbuild-docker.sh
@@ -56,17 +56,13 @@ create_container() {
 	install -d $topdir/logs
 
 	# start the container
-	docker run --name=$name -d \
-		-w $home \
-		-v $topdir:$home/rpm \
-		-v $dir:$home/cleanbuild \
-		-v $dir/cache/poldek:/var/cache/poldek \
-		-v $dir/cache/ccache/$PACKAGE_NAME:$home/.ccache \
-		--label=cleanbuild=$name \
-		$(tmpfs) \
-		$image >/dev/null
-
-	# set the homedir
+	TMPFS_SIZE=$TMPFS \
+	PACKAGE_NAME=$PACKAGE_NAME \
+	docker-compose run --rm -d \
+		--name=$name \
+		--label=cleanbuild=$PACKAGE_NAME \
+		cleanbuild
+
 	docker exec --user=root -w / $name usermod -d $home builder
 
 	# these paths need to be accessible for builder
diff --git a/docker-compose.yml b/docker-compose.yml
new file mode 100644
index 0000000..7bb6a55
--- /dev/null
+++ b/docker-compose.yml
@@ -0,0 +1,15 @@
+version: "3.8"
+
+services:
+  cleanbuild:
+    image: registry.gitlab.com/pld-linux/cleanbuild
+    working_dir: /home/builder
+    volumes:
+      - ./rpm:/home/builder/rpm
+      - ./:/home/builder/cleanbuild
+      - ./cache/poldek:/var/cache/poldek
+      - ./cache/ccache/$PACKAGE_NAME:/home/builder/.ccache
+    tmpfs:
+      - /home/builder/rpm/BUILD:exec,nosuid,nodev,size=$TMPFS_SIZE
+
+# vim:ts=2:sw=2:et
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/projects/cleanbuild.git/commitdiff/970162d0a0e6f66049427fd3754e1cac7e2e56ad



More information about the pld-cvs-commit mailing list