Added a bit more automation to build processes (only supported versions)

master
ops 2021-03-22 14:53:31 -05:00
parent 413a57a781
commit f59640a0e3
14 changed files with 354 additions and 36 deletions

View File

@ -1,6 +1,47 @@
#!/bin/sh
#!/bin/bash
docker pull nextcloud:19-fpm-alpine
docker build $1\
-t bkraul/nextcloud:19-fpm-alpine \
.
# define variables.
IMAGE_VARIANT=fpm-alpine
IMAGE_VERSION=19
UPSTREAM_IMAGE=nextcloud
UPSTREAM_IMAGE_TAG=${IMAGE_VERSION}-${IMAGE_VARIANT}
IMAGE=bkraul/nextcloud
# set username and password
# requires vars DOCKER_USER and DOCKER_PASS to be defined before calling.
# useful functions.
function docker_tag_exists() {
TOKEN=$(curl -s -H "Content-Type: application/json" -X POST -d '{"username": "'${DOCKER_USER}'", "password": "'${DOCKER_PASS}'"}' https://hub.docker.com/v2/users/login/ | jq -r .token)
curl --silent -f --head -lL https://hub.docker.com/v2/repositories/$1/tags/$2/ > /dev/null
}
# pull the parent image from docker hub.
docker pull ${UPSTREAM_IMAGE}:${UPSTREAM_IMAGE_TAG}
UPSTREAM_ID=$(docker image inspect --format='{{index .Id}}' ${UPSTREAM_IMAGE}:${UPSTREAM_IMAGE_TAG})
UPSTREAM_ID=${UPSTREAM_ID:7}
# get the version number.
NEXTCLOUD_VERSION=$(docker inspect ${UPSTREAM_IMAGE}:${UPSTREAM_IMAGE_TAG} | jq -r '.[].Config.Env[] | select(match("^NEXTCLOUD_VERSION"))')
NEXTCLOUD_VERSION=${NEXTCLOUD_VERSION:18}
IMAGE_TAG=${NEXTCLOUD_VERSION}-${IMAGE_VARIANT}
if docker_tag_exists ${IMAGE} ${IMAGE_TAG}; then
# nothing to do, the image already exists.
echo Image ${IMAGE}:${IMAGE_TAG} already exists.
else
# image doesn't exist we need build and push
echo Image ${IMAGE}:${IMAGE_TAG} does not exist.
echo "Building image(s)..."
docker build $1 \
-t ${IMAGE}:${UPSTREAM_IMAGE_TAG} \
-t ${IMAGE}:${IMAGE_TAG}
if [ $? == 0 ]; then
echo "Pushing image(s)..."
docker push ${IMAGE}:${IMAGE_TAG}
docker push ${IMAGE}:${UPSTREAM_IMAGE_TAG}
else
echo "The build operation failed."
echo "Please debug and try again."
fi
fi

View File

@ -1,4 +0,0 @@
#!/bin/sh
docker push bkraul/nextcloud:19-fpm-alpine

View File

@ -1,6 +1,48 @@
#!/bin/sh
#!/bin/bash
docker pull nextcloud:20-fpm-alpine
docker build $1\
-t bkraul/nextcloud:20-fpm-alpine \
.
# define variables.
IMAGE_VARIANT=fpm-alpine
IMAGE_VERSION=20
UPSTREAM_IMAGE=nextcloud
UPSTREAM_IMAGE_TAG=${IMAGE_VERSION}-${IMAGE_VARIANT}
IMAGE=bkraul/nextcloud
# set username and password
# requires vars DOCKER_USER and DOCKER_PASS to be defined before calling.
# useful functions.
function docker_tag_exists() {
TOKEN=$(curl -s -H "Content-Type: application/json" -X POST -d '{"username": "'${DOCKER_USER}'", "password": "'${DOCKER_PASS}'"}' https://hub.docker.com/v2/users/login/ | jq -r .token)
curl --silent -f --head -lL https://hub.docker.com/v2/repositories/$1/tags/$2/ > /dev/null
}
# pull the parent image from docker hub.
docker pull ${UPSTREAM_IMAGE}:${UPSTREAM_IMAGE_TAG}
UPSTREAM_ID=$(docker image inspect --format='{{index .Id}}' ${UPSTREAM_IMAGE}:${UPSTREAM_IMAGE_TAG})
UPSTREAM_ID=${UPSTREAM_ID:7}
# get the version number.
NEXTCLOUD_VERSION=$(docker inspect ${UPSTREAM_IMAGE}:${UPSTREAM_IMAGE_TAG} | jq -r '.[].Config.Env[] | select(match("^NEXTCLOUD_VERSION"))')
NEXTCLOUD_VERSION=${NEXTCLOUD_VERSION:18}
IMAGE_TAG=${NEXTCLOUD_VERSION}-${IMAGE_VARIANT}
if docker_tag_exists ${IMAGE} ${IMAGE_TAG}; then
# nothing to do, the image already exists.
echo Image ${IMAGE}:${IMAGE_TAG} already exists.
else
exit 0
# image doesn't exist we need build and push
echo Image ${IMAGE}:${IMAGE_TAG} does not exist.
echo "Building image(s)..."
docker build $1 \
-t ${IMAGE}:${UPSTREAM_IMAGE_TAG} \
-t ${IMAGE}:${IMAGE_TAG}
if [ $? == 0 ]; then
echo "Pushing image(s)..."
docker push ${IMAGE}:${IMAGE_TAG}
docker push ${IMAGE}:${UPSTREAM_IMAGE_TAG}
else
echo "The build operation failed."
echo "Please debug and try again."
fi
fi

View File

@ -1,4 +0,0 @@
#!/bin/sh
docker push bkraul/nextcloud:20-fpm-alpine

21
fpm-alpine/21/Dockerfile Normal file
View File

@ -0,0 +1,21 @@
FROM nextcloud:21-fpm-alpine
RUN set -ex; \
apk add --no-cache --virtual .build-deps \
autoconf \
automake \
file \
g++ \
gcc \
make \
php7-dev \
re2c \
samba-dev \
zlib-dev; \
apk add --no-cache libsmbclient; \
pecl install smbclient; \
docker-php-ext-enable smbclient; \
apk add --no-cache imagemagick; \
apk del .build-deps
COPY redis.config.php /usr/src/nextcloud/config/redis.config.php

48
fpm-alpine/21/build Executable file
View File

@ -0,0 +1,48 @@
#!/bin/bash
# define variables.
IMAGE_VARIANT=fpm-alpine
IMAGE_VERSION=21
UPSTREAM_IMAGE=nextcloud
UPSTREAM_IMAGE_TAG=${IMAGE_VERSION}-${IMAGE_VARIANT}
IMAGE=bkraul/nextcloud
# set username and password
# requires vars DOCKER_USER and DOCKER_PASS to be defined before calling.
# useful functions.
function docker_tag_exists() {
TOKEN=$(curl -s -H "Content-Type: application/json" -X POST -d '{"username": "'${DOCKER_USER}'", "password": "'${DOCKER_PASS}'"}' https://hub.docker.com/v2/users/login/ | jq -r .token)
curl --silent -f --head -lL https://hub.docker.com/v2/repositories/$1/tags/$2/ > /dev/null
}
# pull the parent image from docker hub.
docker pull ${UPSTREAM_IMAGE}:${UPSTREAM_IMAGE_TAG}
UPSTREAM_ID=$(docker image inspect --format='{{index .Id}}' ${UPSTREAM_IMAGE}:${UPSTREAM_IMAGE_TAG})
UPSTREAM_ID=${UPSTREAM_ID:7}
# get the version number.
NEXTCLOUD_VERSION=$(docker inspect ${UPSTREAM_IMAGE}:${UPSTREAM_IMAGE_TAG} | jq -r '.[].Config.Env[] | select(match("^NEXTCLOUD_VERSION"))')
NEXTCLOUD_VERSION=${NEXTCLOUD_VERSION:18}
IMAGE_TAG=${NEXTCLOUD_VERSION}-${IMAGE_VARIANT}
if docker_tag_exists ${IMAGE} ${IMAGE_TAG}; then
# nothing to do, the image already exists.
echo Image ${IMAGE}:${IMAGE_TAG} already exists.
else
exit 0
# image doesn't exist we need build and push
echo Image ${IMAGE}:${IMAGE_TAG} does not exist.
echo "Building image(s)..."
docker build $1 \
-t ${IMAGE}:${UPSTREAM_IMAGE_TAG} \
-t ${IMAGE}:${IMAGE_TAG}
if [ $? == 0 ]; then
echo "Pushing image(s)..."
docker push ${IMAGE}:${IMAGE_TAG}
docker push ${IMAGE}:${UPSTREAM_IMAGE_TAG}
else
echo "The build operation failed."
echo "Please debug and try again."
fi
fi

View File

@ -0,0 +1,8 @@
<?php
$CONFIG = array (
'memcache.locking' => '\OC\Memcache\Redis',
'redis' => array(
'host' => 'redis',
'port' => 6379,
),
);

View File

@ -1,6 +1,47 @@
#!/bin/sh
#!/bin/bash
docker pull nextcloud:19-fpm
docker build $1\
-t bkraul/nextcloud:19-fpm \
.
# define variables.
IMAGE_VARIANT=fpm
IMAGE_VERSION=19
UPSTREAM_IMAGE=nextcloud
UPSTREAM_IMAGE_TAG=${IMAGE_VERSION}-${IMAGE_VARIANT}
IMAGE=bkraul/nextcloud
# set username and password
# requires vars DOCKER_USER and DOCKER_PASS to be defined before calling.
# useful functions.
function docker_tag_exists() {
TOKEN=$(curl -s -H "Content-Type: application/json" -X POST -d '{"username": "'${DOCKER_USER}'", "password": "'${DOCKER_PASS}'"}' https://hub.docker.com/v2/users/login/ | jq -r .token)
curl --silent -f --head -lL https://hub.docker.com/v2/repositories/$1/tags/$2/ > /dev/null
}
# pull the parent image from docker hub.
docker pull ${UPSTREAM_IMAGE}:${UPSTREAM_IMAGE_TAG}
UPSTREAM_ID=$(docker image inspect --format='{{index .Id}}' ${UPSTREAM_IMAGE}:${UPSTREAM_IMAGE_TAG})
UPSTREAM_ID=${UPSTREAM_ID:7}
# get the version number.
NEXTCLOUD_VERSION=$(docker inspect ${UPSTREAM_IMAGE}:${UPSTREAM_IMAGE_TAG} | jq -r '.[].Config.Env[] | select(match("^NEXTCLOUD_VERSION"))')
NEXTCLOUD_VERSION=${NEXTCLOUD_VERSION:18}
IMAGE_TAG=${NEXTCLOUD_VERSION}-${IMAGE_VARIANT}
if docker_tag_exists ${IMAGE} ${IMAGE_TAG}; then
# nothing to do, the image already exists.
echo Image ${IMAGE}:${IMAGE_TAG} already exists.
else
# image doesn't exist we need build and push
echo Image ${IMAGE}:${IMAGE_TAG} does not exist.
echo "Building image(s)..."
docker build $1 \
-t ${IMAGE}:${UPSTREAM_IMAGE_TAG} \
-t ${IMAGE}:${IMAGE_TAG}
if [ $? == 0 ]; then
echo "Pushing image(s)..."
docker push ${IMAGE}:${IMAGE_TAG}
docker push ${IMAGE}:${UPSTREAM_IMAGE_TAG}
else
echo "The build operation failed."
echo "Please debug and try again."
fi
fi

View File

@ -1,4 +0,0 @@
#!/bin/sh
docker push bkraul/nextcloud:19-fpm

View File

@ -1,6 +1,47 @@
#!/bin/sh
#!/bin/bash
docker pull nextcloud:20-fpm
docker build $1\
-t bkraul/nextcloud:20-fpm \
.
# define variables.
IMAGE_VARIANT=fpm
IMAGE_VERSION=20
UPSTREAM_IMAGE=nextcloud
UPSTREAM_IMAGE_TAG=${IMAGE_VERSION}-${IMAGE_VARIANT}
IMAGE=bkraul/nextcloud
# set username and password
# requires vars DOCKER_USER and DOCKER_PASS to be defined before calling.
# useful functions.
function docker_tag_exists() {
TOKEN=$(curl -s -H "Content-Type: application/json" -X POST -d '{"username": "'${DOCKER_USER}'", "password": "'${DOCKER_PASS}'"}' https://hub.docker.com/v2/users/login/ | jq -r .token)
curl --silent -f --head -lL https://hub.docker.com/v2/repositories/$1/tags/$2/ > /dev/null
}
# pull the parent image from docker hub.
docker pull ${UPSTREAM_IMAGE}:${UPSTREAM_IMAGE_TAG}
UPSTREAM_ID=$(docker image inspect --format='{{index .Id}}' ${UPSTREAM_IMAGE}:${UPSTREAM_IMAGE_TAG})
UPSTREAM_ID=${UPSTREAM_ID:7}
# get the version number.
NEXTCLOUD_VERSION=$(docker inspect ${UPSTREAM_IMAGE}:${UPSTREAM_IMAGE_TAG} | jq -r '.[].Config.Env[] | select(match("^NEXTCLOUD_VERSION"))')
NEXTCLOUD_VERSION=${NEXTCLOUD_VERSION:18}
IMAGE_TAG=${NEXTCLOUD_VERSION}-${IMAGE_VARIANT}
if docker_tag_exists ${IMAGE} ${IMAGE_TAG}; then
# nothing to do, the image already exists.
echo Image ${IMAGE}:${IMAGE_TAG} already exists.
else
# image doesn't exist we need build and push
echo Image ${IMAGE}:${IMAGE_TAG} does not exist.
echo "Building image(s)..."
docker build $1 \
-t ${IMAGE}:${UPSTREAM_IMAGE_TAG} \
-t ${IMAGE}:${IMAGE_TAG}
if [ $? == 0 ]; then
echo "Pushing image(s)..."
docker push ${IMAGE}:${IMAGE_TAG}
docker push ${IMAGE}:${UPSTREAM_IMAGE_TAG}
else
echo "The build operation failed."
echo "Please debug and try again."
fi
fi

View File

@ -1,4 +0,0 @@
#!/bin/sh
docker push bkraul/nextcloud:20-fpm

38
fpm/21/Dockerfile Normal file
View File

@ -0,0 +1,38 @@
FROM nextcloud:21-fpm
RUN set -ex \
usermod -u 82 www-data; \
groupmod -g 82 www-data; \
usermod -g 82 www-data; \
# for some reason this needs to be repeated.
usermod -u 82 www-data; \
chown -R www-data:root /var/www; \
chmod -R g=u /var/www
RUN set -ex; \
apt-get update; \
apt-get install -y \
libmagickcore-6.q16-3-extra; \
rm -rf /var/lib/apt/lists/*;
RUN set -ex; \
savedAptMark="$(apt-mark showmanual)"; \
apt-get update; \
apt-get install -y libsmbclient-dev; \
pecl install smbclient; \
docker-php-ext-enable smbclient; \
# reset apt-mark's "manual" list so that "purge --auto-remove" will remove all build dependencies
apt-mark auto '.*' > /dev/null; \
apt-mark manual $savedAptMark; \
ldd "$(php -r 'echo ini_get("extension_dir");')"/*.so \
| awk '/=>/ { print $3 }' \
| sort -u \
| xargs -r dpkg-query -S \
| cut -d: -f1 \
| sort -u \
| xargs -rt apt-mark manual; \
\
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \
rm -rf /var/lib/apt/lists/*
COPY redis.config.php /usr/src/nextcloud/config/redis.config.php

46
fpm/21/build Executable file
View File

@ -0,0 +1,46 @@
#!/bin/bash
# define variables.
IMAGE_VARIANT=fpm
IMAGE_VERSION=21
UPSTREAM_IMAGE=nextcloud
UPSTREAM_IMAGE_TAG=${IMAGE_VERSION}-${IMAGE_VARIANT}
IMAGE=bkraul/nextcloud
# set username and password
# requires vars DOCKER_USER and DOCKER_PASS to be defined before calling.
# useful functions.
function docker_tag_exists() {
TOKEN=$(curl -s -H "Content-Type: application/json" -X POST -d '{"username": "'${DOCKER_USER}'", "password": "'${DOCKER_PASS}'"}' https://hub.docker.com/v2/users/login/ | jq -r .token)
curl --silent -f --head -lL https://hub.docker.com/v2/repositories/$1/tags/$2/ > /dev/null
}
# pull the parent image from docker hub.
docker pull ${UPSTREAM_IMAGE}:${UPSTREAM_IMAGE_TAG}
UPSTREAM_ID=$(docker image inspect --format='{{index .Id}}' ${UPSTREAM_IMAGE}:${UPSTREAM_IMAGE_TAG})
UPSTREAM_ID=${UPSTREAM_ID:7}
# get the version number.
NEXTCLOUD_VERSION=$(docker inspect ${UPSTREAM_IMAGE}:${UPSTREAM_IMAGE_TAG} | jq -r '.[].Config.Env[] | select(match("^NEXTCLOUD_VERSION"))')
NEXTCLOUD_VERSION=${NEXTCLOUD_VERSION:18}
IMAGE_TAG=${NEXTCLOUD_VERSION}-${IMAGE_VARIANT}
if docker_tag_exists ${IMAGE} ${IMAGE_TAG}; then
# nothing to do, the image already exists.
echo Image ${IMAGE}:${IMAGE_TAG} already exists.
else
# image doesn't exist we need build and push
echo Image ${IMAGE}:${IMAGE_TAG} does not exist.
echo "Building image(s)..."
docker build $1 \
-t ${IMAGE}:${UPSTREAM_IMAGE_TAG} \
-t ${IMAGE}:${IMAGE_TAG}
if [ $? == 0 ]; then
echo "Pushing image(s)..."
docker push ${IMAGE}:${IMAGE_TAG}
docker push ${IMAGE}:${UPSTREAM_IMAGE_TAG}
else
echo "The build operation failed."
echo "Please debug and try again."
fi

8
fpm/21/redis.config.php Normal file
View File

@ -0,0 +1,8 @@
<?php
$CONFIG = array (
'memcache.locking' => '\OC\Memcache\Redis',
'redis' => array(
'host' => 'redis',
'port' => 6379,
),
);