mirror of
https://github.com/nextcloud/docker.git
synced 2025-06-17 08:34:48 +02:00
POC: Introduce Nextcloud based on Nginx web server.
This PR introduce POC of Nextcloud based on Nginx web server with php-fpm in separated container.
Basic installation with SQLite and few operations in web gui were tested.
Nginx dockerfile is generated from Dockerfile-nginx.template
- FROM string has hardcoded variant - apache
- There is no upstream PHP image with Nginx, due this generate-stackbrew-library is not able to identify parent correctly
New files were introduced in image:
- Dockerfile-nginx.template
- nginx-foreground
+ simulates behavior of apache2-foreground cmd
- 16.0/nginx/Dockerfile
+ generated from template Dockerfile-nginx.template
- nextcloud.confx
+ Nginx vhost configuration
- start_net.sh (temporary)
+ Helper script to create user-defined network for Docker
+ '--link' option for docker create is obsolete and we need communication between fpm and nginx container
- start_container.sh (temporary)
+ Helper script to handle containers
- Dockerfile
+ /Dockerfile for verification purposes
Updated files:
- set -x added to all shell scripts for easier troubleshooting (temporary)
- update.sh
+ New variant introduced
+ Number of builded variant is limited for simplified CI.
- .travis.yml (temporary)
+ Image push to registry for testing purposes
- docker-entrypoint.sh
+ Recognizes new argument for entrypoint - nginx-foreground
Be careful during review, github recognizes removed files for 15.0 release as renamed to 16.0/nginx variant
Motivation/Usecase:
- I have openvz based VPS where only old Docker 1.10 is supported.
- Apache(in nextcloud container) in combination Nginx as a reverse proxy for multiple vhosts doesn't work correctly
Image pull link:
docker pull 1john2ci/nextcloud:apache-20190509
docker pull 1john2ci/nextcloud:fpm-20190509
Travis CI test: 530329740
Deployment notes:
- Clone source code
- Create user-defined network for Docker
- Start fpm container
- Start nginx container
This commit is contained in:
parent
a2d0c57921
commit
b1cf796d55
79 changed files with 568 additions and 2082 deletions
58
update.sh
58
update.sh
|
@ -1,27 +1,39 @@
|
|||
#!/bin/bash
|
||||
set -eo pipefail
|
||||
set -xeo pipefail
|
||||
|
||||
declare -A php_version=(
|
||||
[default]='7.3'
|
||||
[14.0]='7.2'
|
||||
)
|
||||
|
||||
# ##
|
||||
# Introduce nginx entrycmd
|
||||
# ##
|
||||
declare -A cmd=(
|
||||
[apache]='apache2-foreground'
|
||||
[fpm]='php-fpm'
|
||||
[fpm-alpine]='php-fpm'
|
||||
[nginx]='nginx-foreground'
|
||||
)
|
||||
|
||||
# ##
|
||||
# Set Nginx base image(not updated in Dockerfile)
|
||||
# ##
|
||||
declare -A base=(
|
||||
[apache]='debian'
|
||||
[fpm]='debian'
|
||||
[fpm-alpine]='alpine'
|
||||
[nginx]='nginx'
|
||||
)
|
||||
|
||||
# ##
|
||||
# Configure extras for nginx
|
||||
# ##
|
||||
declare -A extras=(
|
||||
[apache]='\nRUN a2enmod rewrite remoteip ;\\\n {\\\n echo RemoteIPHeader X-Real-IP ;\\\n echo RemoteIPTrustedProxy 10.0.0.0/8 ;\\\n echo RemoteIPTrustedProxy 172.16.0.0/12 ;\\\n echo RemoteIPTrustedProxy 192.168.0.0/16 ;\\\n } > /etc/apache2/conf-available/remoteip.conf;\\\n a2enconf remoteip'
|
||||
[fpm]=''
|
||||
[fpm-alpine]=''
|
||||
[nginx]=''
|
||||
)
|
||||
|
||||
apcu_version="$(
|
||||
|
@ -66,11 +78,13 @@ declare -A pecl_versions=(
|
|||
[redis]="$redis_version"
|
||||
[imagick]="$imagick_version"
|
||||
)
|
||||
|
||||
# ##
|
||||
# Introduce new variant - Nginx
|
||||
# ##
|
||||
variants=(
|
||||
apache
|
||||
fpm
|
||||
fpm-alpine
|
||||
nginx
|
||||
)
|
||||
|
||||
min_version='14.0'
|
||||
|
@ -103,14 +117,23 @@ function create_variant() {
|
|||
|
||||
# Create the version+variant directory with a Dockerfile.
|
||||
mkdir -p "$dir"
|
||||
|
||||
echo "updating $fullversion [$1] $variant"
|
||||
# ##
|
||||
# Create new Dockerfile
|
||||
# ##
|
||||
template="Dockerfile-${base[$variant]}.template"
|
||||
echo "# DO NOT EDIT: created by update.sh from $template" > "$dir/Dockerfile"
|
||||
cat "$template" >> "$dir/Dockerfile"
|
||||
|
||||
echo "updating $fullversion [$1] $variant"
|
||||
|
||||
# Replace the variables.
|
||||
if [ "${variant}" == 'nginx' ]; then
|
||||
# ##
|
||||
# Upload Nginx config files & scripts
|
||||
# ##
|
||||
for name in nextcloud.conf nginx-foreground; do
|
||||
cp "${name}" "${dir}/${name}"
|
||||
done
|
||||
fi
|
||||
# Replace the variables.
|
||||
sed -ri -e '
|
||||
s/%%PHP_VERSION%%/'"$phpVersion"'/g;
|
||||
s/%%VARIANT%%/'"$variant"'/g;
|
||||
|
@ -145,7 +168,9 @@ function create_variant() {
|
|||
if [ "$variant" != "apache" ]; then
|
||||
rm "$dir/config/apache-pretty-urls.config.php"
|
||||
fi
|
||||
|
||||
# ##
|
||||
# Limit archs of builded images for easier CI
|
||||
# ##
|
||||
for arch in i386 amd64; do
|
||||
travisEnv=' - env: VERSION='"$1"' VARIANT='"$variant"' ARCH='"$arch"'\n'"$travisEnv"
|
||||
done
|
||||
|
@ -158,6 +183,11 @@ fullversions=( $( curl -fsSL 'https://download.nextcloud.com/server/releases/' |
|
|||
grep -oE '[[:digit:]]+(\.[[:digit:]]+){2}' | \
|
||||
sort -urV ) )
|
||||
versions=( $( printf '%s\n' "${fullversions[@]}" | cut -d. -f1-2 | sort -urV ) )
|
||||
# ##
|
||||
# Limit version of builded images to current for easier CI
|
||||
# TODO: introduce Nginx minimal version, put code "for version in versions" in function, handle params
|
||||
# ##
|
||||
versions=('16.0')
|
||||
for version in "${versions[@]}"; do
|
||||
fullversion="$( printf '%s\n' "${fullversions[@]}" | grep -E "^$version" | head -1 )"
|
||||
|
||||
|
@ -183,8 +213,8 @@ for version in "${versions_rc[@]}"; do
|
|||
if ! check_released "$fullversion"; then
|
||||
|
||||
for variant in "${variants[@]}"; do
|
||||
|
||||
create_variant "$version-rc" "https:\/\/download.nextcloud.com\/server\/prereleases"
|
||||
echo "skipping ${version}"
|
||||
#create_variant "$version-rc" "https:\/\/download.nextcloud.com\/server\/prereleases"
|
||||
done
|
||||
fi
|
||||
fi
|
||||
|
@ -203,8 +233,8 @@ for version in "${versions_beta[@]}"; do
|
|||
if ! check_rc_released "$fullversion"; then
|
||||
|
||||
for variant in "${variants[@]}"; do
|
||||
|
||||
create_variant "$version-beta" "https:\/\/download.nextcloud.com\/server\/prereleases"
|
||||
echo "skipping ${version}"
|
||||
#create_variant "$version-beta" "https:\/\/download.nextcloud.com\/server\/prereleases"
|
||||
done
|
||||
fi
|
||||
fi
|
||||
|
@ -223,8 +253,8 @@ for version in "${versions_alpha[@]}"; do
|
|||
if ! check_beta_released "$fullversion"; then
|
||||
|
||||
for variant in "${variants[@]}"; do
|
||||
|
||||
create_variant "$version-alpha" "https:\/\/download.nextcloud.com\/server\/prereleases"
|
||||
echo "skipping ${version}"
|
||||
#create_variant "$version-alpha" "https:\/\/download.nextcloud.com\/server\/prereleases"
|
||||
done
|
||||
fi
|
||||
fi
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue