├── .gitignore ├── .travis.yml ├── LICENSE ├── README.md ├── VERSION ├── build_debian_package.sh ├── control_file_template ├── deploy_debian_package.sh ├── fix_pyinstaller.sh ├── patches ├── Dockerfile └── Dockerfile.pyinstaller ├── test.sh └── test └── Dockerfile /.gitignore: -------------------------------------------------------------------------------- 1 | compose/ 2 | dist/ 3 | temp/ 4 | *.deb 5 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | sudo: required 2 | services: 3 | - docker 4 | language: bash 5 | script: 6 | # prepare qemu 7 | - docker run --rm --privileged multiarch/qemu-user-static:register --reset 8 | # build docker-compose for ARM 9 | - git clone -b $(cat VERSION) https://github.com/docker/compose 10 | - cp -r patches/* compose/ 11 | - sed -i '/.git/d' compose/.dockerignore 12 | - sed -i 's/py34,//' compose/tox.ini 13 | - docker build -t docker-compose-builder compose 14 | - docker create --name tmp docker-compose-builder 15 | - docker cp tmp:/code/dist dist 16 | # build deb package 17 | - ./build_debian_package.sh docker-compose "$(cat VERSION)" $(pwd) 18 | # test deb package 19 | - ./test.sh 20 | # build and push hypriot/arm-pyinstaller image 21 | - > 22 | if [ "$TRAVIS_BRANCH" == "pyinstaller" ]; then 23 | docker build -t hypriot/arm-pyinstaller -f Dockerfile.pyinstaller compose 24 | docker login -u="$DOCKER_USER" -p="$DOCKER_PASS" 25 | docker push hypriot/arm-pyinstaller 26 | fi 27 | 28 | - > 29 | if [ "$TRAVIS_BRANCH" == "master" ]; then 30 | ./deploy_debian_package.sh $(pwd) 31 | fi 32 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Hypriot 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # arm-compose [![Build Status](https://travis-ci.org/hypriot/arm-compose.svg?branch=master)](https://travis-ci.org/hypriot/arm-compose) 2 | 3 | This is an automated build for docker-compose on ARM. 4 | This build clones the official repo [docker/compose](https://github.com/docker/compose) and generates an ARMv7 binary. 5 | 6 | ## Installation 7 | 8 | You can find the DEB package for `docker-compose` in Hypriot's Schatzkiste. Add the repo if it isn't already added (newer versions of the HypriotOS SD image already have this entry). 9 | 10 | ### Add repo 11 | 12 | ```bash 13 | sudo apt-get update 14 | sudo apt-get install -y apt-transport-https 15 | echo "deb https://packagecloud.io/Hypriot/Schatzkiste/debian/ jessie main" | sudo tee /etc/apt/sources.list.d/hypriot.list 16 | sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 37BBEE3F7AD95B3F 17 | ``` 18 | 19 | ### Install or Update 20 | 21 | ```bash 22 | sudo apt-get update 23 | sudo apt-get install docker-compose 24 | ``` 25 | 26 | ## Contributing 27 | 28 | ### Customize the build 29 | 30 | The only customization is done in the `VERSION` file. This file contains the tag to build. 31 | 32 | ### Build script 33 | 34 | This steps to build the ARM binary can be found in the drone.yml. 35 | 36 | ### Patches 37 | 38 | There are some file that have to be patched in the upstream repo. These files are in the `patches` folder. 39 | 40 | #### Patches for ARM 41 | 42 | For the ARM cpu type we have to patch the Dockerfile to adjust the `FROM` line and downloading a docker deb package as well as the PyInstaller 3.0 ARM bootloader. 43 | 44 | * Dockerfile 45 | -------------------------------------------------------------------------------- /VERSION: -------------------------------------------------------------------------------- 1 | 1.9.0 2 | -------------------------------------------------------------------------------- /build_debian_package.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | # bash script to create a simple debian package 3 | 4 | gem install fpm 5 | 6 | PACKAGE_NAME=$1 7 | PACKAGE_VERSION=$2 8 | BUILD_DIR=$3 9 | BUILD_NUMBER=${TRAVIS_BUILD_NUMBER} 10 | 11 | mkdir temp 12 | cd temp 13 | 14 | # Set fpm arguments 15 | declare -a FPM_ARGS 16 | FPM_ARGS+=(-s dir) 17 | FPM_ARGS+=(-t deb) 18 | FPM_ARGS+=(--force) 19 | FPM_ARGS+=(--verbose) 20 | FPM_ARGS+=(--vendor "Docker") 21 | FPM_ARGS+=(--category "net") 22 | FPM_ARGS+=(--maintainer "Hypriot") 23 | FPM_ARGS+=(--architecture "armhf") 24 | FPM_ARGS+=(--url "http://blog.hypriot.com") 25 | FPM_ARGS+=(--license "Apache License Version 2.0") 26 | FPM_ARGS+=(--name "${PACKAGE_NAME}") 27 | FPM_ARGS+=(--version "${PACKAGE_VERSION}") 28 | FPM_ARGS+=(--description "docker-compose for armhf") 29 | FPM_ARGS+=(--prefix /usr/local/bin) 30 | FPM_ARGS+=(--iteration ${BUILD_NUMBER}) 31 | FPM_ARGS+=(--package ../) 32 | 33 | # copy binary to destination 34 | cp $BUILD_DIR/dist/docker-compose docker-compose 35 | 36 | set -x 37 | fpm "${FPM_ARGS[@]}" . 38 | -------------------------------------------------------------------------------- /control_file_template: -------------------------------------------------------------------------------- 1 | Package: docker-compose 2 | Version: 3 | Section: admin 4 | Priority: optional 5 | Architecture: armhf 6 | Essential: no 7 | Installed-Size: 14336 8 | Maintainer: blog.hypriot.com 9 | Description: docker-compose for armhf 10 | -------------------------------------------------------------------------------- /deploy_debian_package.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | 4 | gem install package_cloud 5 | 6 | BUILD_DIR=$1 7 | 8 | package_cloud push Hypriot/Schatzkiste/debian/wheezy $BUILD_DIR/*.deb 9 | package_cloud push Hypriot/Schatzkiste/debian/jessie $BUILD_DIR/*.deb 10 | package_cloud push Hypriot/Schatzkiste/raspbian/wheezy $BUILD_DIR/*.deb 11 | package_cloud push Hypriot/Schatzkiste/raspbian/jessie $BUILD_DIR/*.deb 12 | -------------------------------------------------------------------------------- /fix_pyinstaller.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -ex 3 | sed -i '/su -c "$VENV\/bin\/pyinstaller docker-compose.spec" user/d' compose/script/build/linux-entrypoint 4 | sed -i '/pip install/d' compose/script/build/linux-entrypoint 5 | sed -i '/\/script\/build\/write-git-sha/a \su -c "source $VENV\/bin\/activate && $VENV\/lib\/python2.7\/site-packages\/PyInstaller\/pyinstaller.py docker-compose.spec" user' compose/script/build/linux-entrypoint 6 | -------------------------------------------------------------------------------- /patches/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM hypriot/arm-pyinstaller 2 | 3 | ADD . /code/ 4 | RUN chown -R user /code/ 5 | 6 | ENV VENV /code/.tox/py27 7 | RUN mkdir -p dist 8 | RUN chmod 777 dist 9 | RUN $VENV/bin/pip install -q -r requirements-build.txt 10 | RUN ./script/build/write-git-sha 11 | RUN su -c "source $VENV\/bin\/activate && $VENV\/lib\/python2.7\/site-packages\/PyInstaller\/pyinstaller.py docker-compose.spec" user 12 | RUN ls -l dist 13 | -------------------------------------------------------------------------------- /patches/Dockerfile.pyinstaller: -------------------------------------------------------------------------------- 1 | FROM resin/rpi-raspbian:wheezy 2 | 3 | RUN set -ex; \ 4 | apt-get update -qq; \ 5 | apt-get install -y \ 6 | locales \ 7 | gcc \ 8 | make \ 9 | zlib1g \ 10 | zlib1g-dev \ 11 | libssl-dev \ 12 | git \ 13 | ca-certificates \ 14 | curl \ 15 | libsqlite3-dev \ 16 | apt-transport-https \ 17 | bzip2 \ 18 | python3 \ 19 | ; \ 20 | rm -rf /var/lib/apt/lists/* 21 | 22 | RUN set -ex; \ 23 | curl -L https://packagecloud.io/Hypriot/Schatzkiste/packages/debian/wheezy/docker-hypriot_1.8.3-1_armhf.deb/download -o docker-hypriot_1.8.3-1_armhf.deb; \ 24 | dpkg -x docker-hypriot_1.8.3-1_armhf.deb /tmp/docker || true; \ 25 | mv /tmp/docker/usr/bin/docker /usr/local/bin/docker; \ 26 | rm -f docker-hypriot_1.8.3-1_armhf.deb; \ 27 | rm -rf /tmp/docker 28 | 29 | # Build Python 2.7.9 from source 30 | RUN set -ex; \ 31 | curl -L https://www.python.org/ftp/python/2.7.9/Python-2.7.9.tgz | tar -xz; \ 32 | cd Python-2.7.9; \ 33 | ./configure --enable-shared; \ 34 | make; \ 35 | make install; \ 36 | cd ..; \ 37 | rm -rf /Python-2.7.9 38 | 39 | # Build python 3.4 from source 40 | # RUN set -ex; \ 41 | # curl -L https://www.python.org/ftp/python/3.4.3/Python-3.4.3.tgz | tar -xz; \ 42 | # cd Python-3.4.3; \ 43 | # ./configure --enable-shared; \ 44 | # make; \ 45 | # make install; \ 46 | # cd ..; \ 47 | # rm -rf /Python-3.4.3 48 | 49 | # Make libpython findable 50 | ENV LD_LIBRARY_PATH /usr/local/lib 51 | 52 | # Install setuptools 53 | RUN set -ex; \ 54 | curl -L https://bootstrap.pypa.io/ez_setup.py | python 55 | 56 | # Install pip 57 | RUN set -ex; \ 58 | curl -L https://pypi.python.org/packages/source/p/pip/pip-8.1.1.tar.gz | tar -xz; \ 59 | cd pip-8.1.1; \ 60 | python setup.py install; \ 61 | cd ..; \ 62 | rm -rf pip-8.1.1 63 | 64 | # Python3 requires a valid locale 65 | RUN echo "en_US.UTF-8 UTF-8" > /etc/locale.gen && locale-gen 66 | ENV LANG en_US.UTF-8 67 | 68 | RUN useradd -d /home/user -m -s /bin/bash user 69 | WORKDIR /code/ 70 | 71 | RUN pip install tox==2.1.1 72 | 73 | ADD requirements.txt /code/ 74 | ADD requirements-dev.txt /code/ 75 | ADD .pre-commit-config.yaml /code/ 76 | ADD setup.py /code/ 77 | ADD tox.ini /code/ 78 | ADD compose /code/compose/ 79 | RUN tox --notest 80 | 81 | RUN set -ex; \ 82 | cd /tmp; \ 83 | curl -L https://github.com/pyinstaller/pyinstaller/releases/download/3.0/PyInstaller-3.0.tar.gz | tar -xz; \ 84 | cd PyInstaller-3.0/bootloader; \ 85 | curl -LO https://raw.githubusercontent.com/matysek/pyinstaller/6d65e7cea428ac207a27297c8adc169c17ee5776/bootloader/wscript; \ 86 | python ./waf distclean --no-lsb all; \ 87 | ln -s /tmp/PyInstaller-3.0 /code/.tox/py27/lib/python2.7/site-packages/PyInstaller; \ 88 | sed -i '/ if is_unix:/i\ \ \ \ return 0' /code/.tox/py27/lib/python2.7/site-packages/PyInstaller/PyInstaller/utils/misc.py 89 | -------------------------------------------------------------------------------- /test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | docker build -t test -f test/Dockerfile . 4 | docker run test docker-compose --version 5 | -------------------------------------------------------------------------------- /test/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM resin/rpi-raspbian:wheezy 2 | COPY . /test 3 | WORKDIR /test 4 | RUN dpkg -i *.deb 5 | --------------------------------------------------------------------------------