initial commit

This commit is contained in:
nicolas.dorier 2018-11-27 00:48:27 +09:00
parent 3c5643ac6d
commit caab222076
3 changed files with 111 additions and 0 deletions

43
.circleci/config.yml Normal file
View File

@ -0,0 +1,43 @@
version: 2
jobs:
build:
machine:
docker_layer_caching: true
steps:
- checkout
# publish jobs require $DOCKERHUB_USER, $DOCKERHUB_PASS defined
publish_linuxarm32v7:
machine:
docker_layer_caching: true
steps:
- checkout
- run:
command: |
LATEST_TAG="${CIRCLE_TAG:1}"
DOCKERHUB_REPO="btcpayserver/docker-compose-builder"
DOCKERHUB_DESTINATION="$DOCKERHUB_REPO:$LATEST_TAG-arm32v7"
DOCKERHUB_DOCKEFILE="linuxarm32v7.Dockerfile"
#
# Make sure the builder is copy the arm emulator
sudo docker run --rm --privileged multiarch/qemu-user-static:register --reset
sudo apt update
sudo apt install -y qemu qemu-user-static qemu-user binfmt-support
sudo cp /usr/bin/qemu-arm-static "$(dirname "$DOCKERHUB_DOCKEFILE")/qemu-arm-static"
sed -i -e 's/#EnableQEMU //g' "$DOCKERHUB_DOCKEFILE"
#
echo "Pushing $DOCKERHUB_DOCKEFILE to dockerhub repository $DOCKERHUB_DESTINATION"
sudo docker login --username=$DOCKERHUB_USER --password=$DOCKERHUB_PASS
sudo docker build --pull --build-arg "DOCKER_COMPOSE_VER=$LATEST_TAG" -t $DOCKERHUB_DESTINATION -f "$DOCKERHUB_DOCKEFILE" .
sudo docker push $DOCKERHUB_DESTINATION
workflows:
version: 2
publish:
jobs:
- publish_linuxarm32v7:
filters:
branches:
ignore: /.*/
tags:
only: /v[0-9]+(\.[0-9]+)*/

18
.gitattributes vendored Normal file
View File

@ -0,0 +1,18 @@
# Set the default behavior, in case people don't have core.autocrlf set.
* text=auto
# Explicitly declare text files you want to always be normalized and converted
# to native line endings on checkout.
*.c text
*.h text
# Declare files that will always have CRLF line endings on checkout.
*.sln text eol=crlf
# Declare files that will always have CRLF line endings on checkout.
*.sh text eol=lf
*.Dockerfile text eol=lf
# Denote all files that are truly binary and should not be modified.
*.png binary
*.jpg binary

50
linuxarm32v7.Dockerfile Normal file
View File

@ -0,0 +1,50 @@
# Dockerfile to build docker-compose for aarch64
FROM arm32v7/python:3.6.5-stretch as builder
# Add env
ENV LANG C.UTF-8
# Enable cross-build for aarch64
#EnableQEMU COPY qemu-arm-static /usr/bin
RUN apt-get update && apt-get install -qq --no-install-recommends unzip
# Set the versions
ARG DOCKER_COMPOSE_VER
# docker-compose requires pyinstaller 3.3.1 (check github.com/docker/compose/requirements-build.txt)
# If this changes, you may need to modify the version of "six" below
ENV PYINSTALLER_VER 3.3.1
# "six" is needed for PyInstaller. v1.11.0 is the latest as of PyInstaller 3.3.1
ENV SIX_VER 1.11.0
# Install dependencies
# RUN apt-get update && apt-get install -y
RUN pip install six==$SIX_VER
# Compile the pyinstaller "bootloader"
# https://pyinstaller.readthedocs.io/en/stable/bootloader-building.html
WORKDIR /build/pyinstallerbootloader
RUN curl -fsSL https://github.com/pyinstaller/pyinstaller/releases/download/v$PYINSTALLER_VER/PyInstaller-$PYINSTALLER_VER.tar.gz | tar xvz >/dev/null \
&& cd PyInstaller*/bootloader \
&& python3 ./waf all
# Clone docker-compose
WORKDIR /build/dockercompose
RUN curl -fsSL https://github.com/docker/compose/archive/$DOCKER_COMPOSE_VER.zip > $DOCKER_COMPOSE_VER.zip \
&& unzip $DOCKER_COMPOSE_VER.zip
# Run the build steps (taken from github.com/docker/compose/script/build/linux-entrypoint)
RUN cd compose-$DOCKER_COMPOSE_VER && mkdir ./dist \
&& pip install -q -r requirements.txt -r requirements-build.txt
RUN cd compose-$DOCKER_COMPOSE_VER \
&& echo "unknown" > compose/GITSHA \
&& pyinstaller docker-compose.spec \
&& mkdir /dist \
&& mv dist/docker-compose /dist/docker-compose
FROM arm32v7/debian:stretch-slim
COPY --from=builder /dist/docker-compose /tmp/docker-compose
# Copy out the generated binary
VOLUME /dist
CMD cp /tmp/docker-compose /dist/docker-compose