Revamped build process

This commit is contained in:
ops 2024-06-02 23:37:22 +00:00
parent 1eabdeea8f
commit 90ecdad357
44 changed files with 141 additions and 756 deletions

102
build Executable file
View File

@ -0,0 +1,102 @@
#!/bin/bash
# use this as: PUSH=0 ./build ... in order to set the variable. default is PUSH=1
PUSH=${PUSH:-1}
FORCE=${FORCE:-0}
if [ ! "$1" == "" ]; then
IMAGE_VERSION=$1
else
echo "No Nextcloud version specified. Exiting (1)."
exit 1
fi
if [ ! "$2" == "" ]; then
VARIANTS=$2
else
VARIANTS=("fpm" "fpm-alpine")
fi
# 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
}
for item in "${!VARIANTS[@]}"
do
IMAGE_VARIANT=${VARIANTS[$item]}
UPSTREAM_IMAGE=nextcloud
UPSTREAM_IMAGE_TAG=${IMAGE_VERSION}-${IMAGE_VARIANT}
IMAGE=bkraul/nextcloud
echo "Building Nextcloud ${IMAGE_VERSION}, variant: ${IMAGE_VARIANT}..."
# pull the parent image from docker hub.
echo "Pulling upstream image ${UPSTREAM_IMAGE}:${UPSTREAM_IMAGE_TAG}..."
docker pull ${UPSTREAM_IMAGE}:${UPSTREAM_IMAGE_TAG} > /dev/null
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.
echo "----------------------------"
echo "FORCE: $FORCE"
if [ $FORCE == 0 ]; then continue; fi
fi
# determine the common files to use.
# Dockerfile
DOCKERFILE_DIR="./build-common/dockerfile"
DOCKERFILE=""
if [ -f "${DOCKERFILE_DIR}/Dockerfile" ]; then DOCKERFILE="${DOCKERFILE_DIR}/Dockerfile"; fi
if [ -f "${DOCKERFILE_DIR}/Dockerfile-${IMAGE_VERSION}" ]; then DOCKERFILE="${DOCKERFILE_DIR}/Dockerfile-${IMAGE_VERSION}"; fi
if [ -f "${DOCKERFILE_DIR}/Dockerfile-${IMAGE_VARIANT}" ]; then echo "Image variant"; DOCKERFILE="${DOCKERFILE_DIR}/Dockerfile-${IMAGE_VARIANT}"; fi
if [ -f "${DOCKERFILE_DIR}/Dockerfile-${IMAGE_VARIANT}-${IMAGE_VERSION}" ]; then DOCKERFILE="${DOCKERFILE_DIR}/Dockerfile-${IMAGE_VARIANT}-${IMAGE_VERSION}"; fi
# if no valid Dockerfile is found, we abort current build and go to next variant if available.
if [ "${DOCKERFILE}" = "" ]; then echo "No valid Dockerfile found."; continue; fi
# image doesn't exist we need build and push
echo Image ${IMAGE}:${IMAGE_TAG} does not exist.
echo "Building image(s)..."
#--file ${DOCKERFILE} \
docker build \
--file ${DOCKERFILE} \
--no-cache \
-t ${IMAGE}:${UPSTREAM_IMAGE_TAG} \
-t ${IMAGE}:${IMAGE_TAG} \
--build-arg BASE_IMAGE="${UPSTREAM_IMAGE}:${UPSTREAM_IMAGE_TAG}" \
--progress plain \
./build-common
if [ $? == 0 ]; then
# don't push if specified so (continue the variant loop).
if [ ${PUSH} == 0 ]; then
echo "----------------------------"
continue;
fi
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
echo "----------------------------"
done

View File

@ -1,4 +1,8 @@
FROM nextcloud:19-fpm
# retrieve the base image (default to latest).
ARG BASE_IMAGE="nextcloud:29-fpm"
FROM ${BASE_IMAGE}
LABEL org.opencontainers.image.authors="Belman Kraul <bkraul@gmail.com>"
RUN set -ex \
usermod -u 82 www-data; \
@ -11,8 +15,7 @@ RUN set -ex \
RUN set -ex; \
apt-get update; \
apt-get install -y \
libmagickcore-6.q16-3-extra; \
apt-get install -y libmagickcore-6.q16-3-extra libsmbclient; \
rm -rf /var/lib/apt/lists/*;
RUN set -ex; \
@ -21,7 +24,9 @@ RUN set -ex; \
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-get install -y libbz2-dev; \
docker-php-ext-install bz2; \
# 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 \
@ -35,4 +40,5 @@ RUN set -ex; \
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
# copy the redis configuration file.
COPY redis/redis.config.php /usr/src/nextcloud/config/redis.config.php

View File

@ -0,0 +1,28 @@
# retrieve the base image (default to latest).
ARG BASE_IMAGE="nextcloud:29-fpm-alpine"
FROM ${BASE_IMAGE}
LABEL org.opencontainers.image.authors="Belman Kraul <bkraul@gmail.com>"
RUN set -ex; \
PHP_VER=${PHP_VERSION:0:3} && PHP_VER=${PHP_VER//.} && \
apk add --no-cache --virtual .build-deps \
autoconf \
automake \
file \
g++ \
gcc \
make \
php${PHP_VER}-dev \
re2c \
samba-dev \
zlib-dev \
bzip2-dev; \
apk add --no-cache libsmbclient; \
pecl install smbclient; \
docker-php-ext-enable smbclient; \
docker-php-ext-install bz2; \
apk add --no-cache imagemagick imagemagick-svg; \
apk del .build-deps
COPY redis/redis.config.php /usr/src/nextcloud/config/redis.config.php

View File

@ -1,22 +0,0 @@
FROM nextcloud:16-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 add --no-cache sudo; \
apk del .build-deps
COPY redis.config.php /usr/src/nextcloud/config/redis.config.php

View File

@ -1,6 +0,0 @@
#!/bin/sh
docker pull nextcloud:16-fpm-alpine
docker build $1\
-t bkraul/nextcloud:16-fpm-alpine \
.

View File

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

View File

@ -1,22 +0,0 @@
FROM nextcloud:17-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 add --no-cache sudo; \
apk del .build-deps
COPY redis.config.php /usr/src/nextcloud/config/redis.config.php

View File

@ -1,6 +0,0 @@
#!/bin/sh
docker pull nextcloud:17-fpm-alpine
docker build $1\
-t bkraul/nextcloud:17-fpm-alpine \
.

View File

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

View File

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

View File

@ -1,21 +0,0 @@
FROM nextcloud:18-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

View File

@ -1,6 +0,0 @@
#!/bin/sh
docker pull nextcloud:18-fpm-alpine
docker build $1\
-t bkraul/nextcloud:18-fpm-alpine \
.

View File

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

View File

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

View File

@ -1,21 +0,0 @@
FROM nextcloud:19-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

View File

@ -1,47 +0,0 @@
#!/bin/bash
# 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,8 +0,0 @@
<?php
$CONFIG = array (
'memcache.locking' => '\OC\Memcache\Redis',
'redis' => array(
'host' => 'redis',
'port' => 6379,
),
);

View File

@ -1,21 +0,0 @@
FROM nextcloud:20-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

View File

@ -1,48 +0,0 @@
#!/bin/bash
# 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,8 +0,0 @@
<?php
$CONFIG = array (
'memcache.locking' => '\OC\Memcache\Redis',
'redis' => array(
'host' => 'redis',
'port' => 6379,
),
);

View File

@ -1,21 +0,0 @@
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

View File

@ -1,48 +0,0 @@
#!/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

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

View File

@ -1,39 +0,0 @@
FROM nextcloud:16-fpm
MAINTAINER Belman Kraul <bkraul@belmankraul.com>
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

View File

@ -1,6 +0,0 @@
#!/bin/sh
docker pull nextcloud:16-fpm
docker build $1\
-t bkraul/nextcloud:16-fpm \
.

View File

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

View File

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

View File

@ -1,39 +0,0 @@
FROM nextcloud:17-fpm
MAINTAINER Belman Kraul <bkraul@belmankraul.com>
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

View File

@ -1,6 +0,0 @@
#!/bin/sh
docker pull nextcloud:17-fpm
docker build $1 \
-t bkraul/nextcloud:17-fpm \
.

View File

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

View File

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

View File

@ -1,38 +0,0 @@
FROM nextcloud:18-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 --allow-unauthenticated update; \
apt-get --allow-unauthenticated 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

View File

@ -1,6 +0,0 @@
#!/bin/sh
docker pull nextcloud:18-fpm
docker build $1\
-t bkraul/nextcloud:18-fpm \
.

View File

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

View File

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

View File

@ -1,47 +0,0 @@
#!/bin/bash
# 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,8 +0,0 @@
<?php
$CONFIG = array (
'memcache.locking' => '\OC\Memcache\Redis',
'redis' => array(
'host' => 'redis',
'port' => 6379,
),
);

View File

@ -1,38 +0,0 @@
FROM nextcloud:20-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

View File

@ -1,47 +0,0 @@
#!/bin/bash
# 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,8 +0,0 @@
<?php
$CONFIG = array (
'memcache.locking' => '\OC\Memcache\Redis',
'redis' => array(
'host' => 'redis',
'port' => 6379,
),
);

View File

@ -1,38 +0,0 @@
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

View File

@ -1,46 +0,0 @@
#!/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

View File

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