summaryrefslogtreecommitdiff
path: root/roles
diff options
context:
space:
mode:
Diffstat (limited to 'roles')
-rw-r--r--roles/apps/collabora/code/tasks/custom-image.yml2
-rw-r--r--roles/apps/nextcloud/tasks/custom-image.yml2
-rwxr-xr-xroles/apps/nextcloud/templates/nextcloud-upgrade.j222
3 files changed, 21 insertions, 5 deletions
diff --git a/roles/apps/collabora/code/tasks/custom-image.yml b/roles/apps/collabora/code/tasks/custom-image.yml
index 088e9318..9659fd75 100644
--- a/roles/apps/collabora/code/tasks/custom-image.yml
+++ b/roles/apps/collabora/code/tasks/custom-image.yml
@@ -10,6 +10,7 @@
FROM {{ item.value.custom_image.from | default('collabora/code:' + item.value.version) }}
{{ item.value.custom_image.dockerfile }}
dest: "{{ collabora_code_base_path }}/{{ item.key }}/build/Dockerfile"
+ register: nextcloud_custom_image_docker
- name: install python-docker
apt:
@@ -20,6 +21,7 @@
docker_image:
name: "collabora/code/{{ item.key }}:{{ item.value.version }}"
state: present
+ force_source: "{{ nextcloud_custom_image_docker is changed }}"
source: build
build:
path: "{{ collabora_code_base_path }}/{{ item.key }}/build"
diff --git a/roles/apps/nextcloud/tasks/custom-image.yml b/roles/apps/nextcloud/tasks/custom-image.yml
index 23454c80..c7e37654 100644
--- a/roles/apps/nextcloud/tasks/custom-image.yml
+++ b/roles/apps/nextcloud/tasks/custom-image.yml
@@ -10,6 +10,7 @@
FROM {{ item.value.custom_image.from | default('nextcloud:' + item.value.version) }}
{{ item.value.custom_image.dockerfile }}
dest: "{{ nextcloud_base_path }}/{{ item.key }}/build/Dockerfile"
+ register: nextcloud_custom_image_docker
- name: install python-docker
apt:
@@ -20,6 +21,7 @@
docker_image:
name: "nextcloud/{{ item.key }}:{{ item.value.version }}"
state: present
+ force_source: "{{ nextcloud_custom_image_docker is changed }}"
source: build
build:
path: "{{ nextcloud_base_path }}/{{ item.key }}/build"
diff --git a/roles/apps/nextcloud/templates/nextcloud-upgrade.j2 b/roles/apps/nextcloud/templates/nextcloud-upgrade.j2
index aac5001f..27bc6222 100755
--- a/roles/apps/nextcloud/templates/nextcloud-upgrade.j2
+++ b/roles/apps/nextcloud/templates/nextcloud-upgrade.j2
@@ -22,14 +22,26 @@ function cleanup {
}
trap cleanup EXIT
-echo "*** Pre-Pulling the image"
-echo ""
-ctr -n k8s.io image pull "docker.io/library/nextcloud:$VERSION"
-echo ""
+IMAGE_BUILD_D="{{ nextcloud_base_path }}/$INST_NAME/build"
+IMAGE_NAME="nextcloud"
+if [ -e "$IMAGE_BUILD_D/Dockerfile" ]; then
+ ## this only works if docker is installed...
+ echo "*** Building custom image"
+ echo ""
+ sed "0,/FROM \(.*\):.*/s//FROM \1:$VERSION/" -i "$IMAGE_BUILD_D/Dockerfile"
+ IMAGE_NAME="nextcloud/$INST_NAME"
+ docker build --rm --network host -t "$IMAGE_NAME:$VERSION" "$IMAGE_BUILD_D"
+ echo ""
+else
+ echo "*** Pre-Pulling the image"
+ echo ""
+ crictl pull "docker.io/library/nextcloud:$VERSION"
+ echo ""
+fi
echo "*** Patching manifest file"
echo ""
-sed "s#image: \"nextcloud:.*\"#image: \"nextcloud:$VERSION\"#" "$K8S_MANIFEST_FILE" > "$TMP_D/upgraded.yml"
+sed "s#image: \"$IMAGE_NAME:.*\"#image: \"$IMAGE_NAME:$VERSION\"#" "$K8S_MANIFEST_FILE" > "$TMP_D/upgraded.yml"
set +e
diff -u "$K8S_MANIFEST_FILE" "$TMP_D/upgraded.yml"
if [ $? -eq 0 ]; then