Skip to content

Commit

Permalink
build: refactor docker builds
Browse files Browse the repository at this point in the history
Signed-off-by: nachoparker <[email protected]>
  • Loading branch information
nachoparker committed May 13, 2019
1 parent d938481 commit 3b36dd3
Show file tree
Hide file tree
Showing 20 changed files with 138 additions and 253 deletions.
48 changes: 0 additions & 48 deletions Makefile

This file was deleted.

7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,9 @@ In order to generate the Docker images
```
git clone https://github.com/nextcloud/nextcloudpi.git
cd nextcloudpi
make # armhf version
make nextcloudpi-x86 # x86 version
./build-docker.sh x86
./build-docker.sh armhf
./build-docker.sh arm64
```

NextCloudPi can be installed in any architecture running the latest Debian
Expand All @@ -126,6 +127,8 @@ https://hub.docker.com/r/ownyourbits/nextcloudpi-x86

https://hub.docker.com/r/ownyourbits/nextcloudpi-armhf

https://hub.docker.com/r/ownyourbits/nextcloudpi-arm64

## Contact

You can find us in the [forums](https://help.nextcloud.com/c/support/appliances-docker-snappy-vm) and a [Telegram group](https://t.me/NextCloudPi)
51 changes: 43 additions & 8 deletions batch.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/bin/bash

# Batch creation of NextCloudPi images and containers
#
# Copyleft 2017 by Ignacio Nunez Hernanz <nacho _a_t_ ownyourbits _d_o_t_ com>
Expand All @@ -10,6 +9,9 @@

set -e

version=$(git describe --tags --always)
version=${version%-*-*}

## BUILDING
source buildlib.sh # initializes $IMGNAME

Expand All @@ -33,28 +35,61 @@ IMG="$( ls -1t tmp/*.img | head -1 )"
# VM
./build-VM.sh

# Docker x86
make nextcloudpi-x86
# Docker
./build-docker.sh x86
./build-docker.sh armhf
./build-docker.sh arm64

[[ "$FTPPASS" == "" ]] && exit

export DOCKER_CLI_EXPERIMENTAL=enabled

# TODO test first
#&& {
docker push ownyourbits/nextcloudpi-x86
docker push ownyourbits/nextcloudpi-x86:${version}
docker push ownyourbits/nextcloud-x86
docker push ownyourbits/nextcloud-x86 :${version}
docker push ownyourbits/lamp-x86
docker push ownyourbits/lamp-x86:${version}
docker push ownyourbits/debian-ncp-x86
docker push ownyourbits/debian-ncp-x86:${version}
#}

# Docker armhf
cp -n /usr/bin/qemu-arm-static docker-armhf && \
make nextcloudpi-armhf

# TODO test first && {
docker push ownyourbits/nextcloudpi-armhf
docker push ownyourbits/nextcloudpi-armhf:${version}
docker push ownyourbits/nextcloud-armhf
docker push ownyourbits/nextcloud-armhf:${version}
docker push ownyourbits/lamp-armhf
docker push ownyourbits/lamp-armhf:${version}
docker push ownyourbits/debian-ncp-armhf
docker push ownyourbits/debian-ncp-armhf:${version}
#}

# TODO test first && {
docker push ownyourbits/nextcloudpi-arm64
docker push ownyourbits/nextcloudpi-arm64:${version}
docker push ownyourbits/nextcloud-arm64
docker push ownyourbits/nextcloud-arm64:${version}
docker push ownyourbits/lamp-arm64
docker push ownyourbits/lamp-arm64:${version}
docker push ownyourbits/debian-ncp-arm64
docker push ownyourbits/debian-ncp-arm64:${version}
#}
rm -f docker-armhf/qemu-arm-static

# Docker multi-arch
docker manifest create --amend ownyourbits/nextcloudpi \
ownyourbits/nextcloudpi-x86 \
ownyourbits/nextcloudpi-armhf \
ownyourbits/nextcloudpi-arm64


docker manifest annotate ownyourbits/nextcloudpi ownyourbits/nextcloudpi-x86 --os linux --arch amd64
docker manifest annotate ownyourbits/nextcloudpi ownyourbits/nextcloudpi-armhf --os linux --arch arm
docker manifest annotate ownyourbits/nextcloudpi ownyourbits/nextcloudpi-arm64 --os linux --arch arm64v8

docker manifest push -p ownyourbits/nextcloudpi

# License
#
Expand Down
2 changes: 1 addition & 1 deletion bin/ncp/BACKUPS/nc-rsync.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ BASEDIR=/var/www
install()
{
apt-get update
apt-get install --no-install-recommends -y rsync
apt-get install --no-install-recommends -y rsync openssh-client
}

configure()
Expand Down
48 changes: 48 additions & 0 deletions build-docker.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Batch-build docker container layers for NextCloudPi
#
# Copyleft 2017 by Ignacio Nunez Hernanz <nacho _a_t_ ownyourbits _d_o_t_ com>
# GPL licensed (see end of file) * Use at your own risk!
#

set -e

version=$(git describe --tags --always)
version=${version%-*-*}

function docker_build() { DOCKER_BUILDKIT=1 docker build --progress=plain . "$@"; }

function build_arch()
{
local arch="${1}"
local arch_qemu="${2}"
local ncp_tag="${3:-arch}"

docker_build -f docker/debian-ncp/Dockerfile -t ownyourbits/debian-ncp-${arch}:latest --pull --build-arg arch=${arch} --build-arg arch_qemu=${arch_qemu}
docker_build -f docker/lamp/Dockerfile -t ownyourbits/lamp-${arch}:latest --build-arg arch=${arch}
docker_build -f docker/nextcloud/Dockerfile -t ownyourbits/nextcloud-${arch}:latest --build-arg arch=${arch}
docker_build -f docker/nextcloudpi/Dockerfile -t ownyourbits/nextcloudpi-${arch}:latest --build-arg arch=${arch}

docker tag ownyourbits/nextcloudpi-${arch}:latest ownyourbits/nextcloudpi-${ncp_tag}:"${version}"
}

[[ "$@" =~ "x86" ]] && build_arch amd64 x86_64 x86
[[ "$@" =~ "armhf" ]] && build_arch armhf arm
[[ "$@" =~ "arm64" ]] && build_arch arm64v8 aarch64 arm64


# License
#
# This script is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This script is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this script; if not, write to the
# Free Software Foundation, Inc., 59 Temple Place, Suite 330,
# Boston, MA 02111-1307 USA
11 changes: 0 additions & 11 deletions docker-armhf/debian-ncp/Dockerfile

This file was deleted.

43 changes: 0 additions & 43 deletions docker-armhf/lamp/Dockerfile

This file was deleted.

52 changes: 0 additions & 52 deletions docker-armhf/nextcloud/Dockerfile

This file was deleted.

69 changes: 0 additions & 69 deletions docker-armhf/nextcloudpi/Dockerfile

This file was deleted.

Loading

0 comments on commit 3b36dd3

Please sign in to comment.