refactor docker deployment

This commit is contained in:
Nicholas St. Germain 2019-01-25 12:34:29 -06:00
parent 98794b3e7b
commit 3896f5242b
8 changed files with 29 additions and 85 deletions

View file

@ -4,12 +4,16 @@ LABEL maintainers="dirtycajunrice,samwiseg0"
ENV DEBUG="False"
COPY / /app
WORKDIR /app
COPY /requirements.txt /Varken.py /app/
COPY /varken /app/varken
COPY /data /app/data
RUN python3 -m pip install -r /app/requirements.txt
WORKDIR /app
CMD cp /app/data/varken.example.ini /config/varken.example.ini && python3 /app/Varken.py --data-folder /config
VOLUME /config

View file

@ -4,14 +4,18 @@ LABEL maintainers="dirtycajunrice,samwiseg0"
ENV DEBUG="False"
COPY / /app
WORKDIR /app
COPY /tmp/qemu-arm-static /usr/bin/qemu-arm-static
COPY /qemu-arm-static /usr/bin/qemu-arm-static
COPY /requirements.txt /Varken.py /app/
COPY /varken /app/varken
COPY /data /app/data
RUN python3 -m pip install -r /app/requirements.txt
WORKDIR /app
CMD cp /app/data/varken.example.ini /config/varken.example.ini && python3 /app/Varken.py --data-folder /config
VOLUME /config

View file

@ -4,14 +4,18 @@ LABEL maintainers="dirtycajunrice,samwiseg0"
ENV DEBUG="False"
COPY / /app
WORKDIR /app
COPY /tmp/qemu-aarch64-static /usr/bin/qemu-aarch64-static
COPY /qemu-aarch64-static /usr/bin/qemu-aarch64-static
COPY /requirements.txt /Varken.py /app/
COPY /varken /app/varken
COPY /data /app/data
RUN python3 -m pip install -r /app/requirements.txt
WORKDIR /app
CMD cp /app/data/varken.example.ini /config/varken.example.ini && python3 /app/Varken.py --data-folder /config
VOLUME /config

View file

@ -1,17 +0,0 @@
FROM arm32v7/python:3.7.2-slim
LABEL maintainers="dirtycajunrice,samwiseg0"
ENV DEBUG="False"
COPY / /app
COPY /tmp/qemu-arm-static /usr/bin/qemu-arm-static
RUN python3 -m pip install -r /app/requirements.txt
WORKDIR /app
CMD cp /app/data/varken.example.ini /config/varken.example.ini && python3 /app/Varken.py --data-folder /config
VOLUME /config

View file

@ -32,9 +32,8 @@ echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USER" --password-stdin
# Prepare QEMU for ARM builds
docker run --rm --privileged multiarch/qemu-user-static:register --reset
wget -P tmp/ "https://github.com/multiarch/qemu-user-static/releases/download/v3.1.0-2/qemu-aarch64-static"
wget -P tmp/ "https://github.com/multiarch/qemu-user-static/releases/download/v3.1.0-2/qemu-arm-static"
chmod +x tmp/qemu-aarch64-static tmp/qemu-arm-static
bash prebuild.sh
chmod +x qemu-aarch64-static qemu-arm-static
# Set tag based off of branch
if [[ "$BRANCH" == "latest" ]]; then
@ -63,22 +62,6 @@ for i in $(ls *arm*); do
if [[ "$BRANCH" == "latest" ]]; then
docker manifest create -a "${REPOSITORY}:${BRANCH}" "${REPOSITORY}:${TAG}-${ARCH}"
fi
if [[ "$ARCH" == "arm64" ]]; then
docker manifest annotate "${REPOSITORY}:${TAG}" "${REPOSITORY}:${TAG}-${ARCH}" --variant v8 --arch arm64
if [[ "$BRANCH" == "latest" ]]; then
docker manifest annotate "${REPOSITORY}:${BRANCH}" "${REPOSITORY}:${TAG}-${ARCH}" --variant v8 --arch arm64
fi
elif [[ "$ARCH" == "armhf" ]]; then
docker manifest annotate "${REPOSITORY}:${TAG}" "${REPOSITORY}:${TAG}-${ARCH}" --variant v7 --arch arm
if [[ "$BRANCH" == "latest" ]]; then
docker manifest annotate "${REPOSITORY}:${BRANCH}" "${REPOSITORY}:${TAG}-${ARCH}" --variant v7 --arch arm
fi
elif [[ "$ARCH" == "arm" ]]; then
docker manifest annotate "${REPOSITORY}:${TAG}" "${REPOSITORY}:${TAG}-${ARCH}" --variant v6 --arch arm
if [[ "$BRANCH" == "latest" ]]; then
docker manifest annotate "${REPOSITORY}:${BRANCH}" "${REPOSITORY}:${TAG}-${ARCH}" --variant v6 --arch arm
fi
fi
done
docker manifest inspect "${REPOSITORY}:${TAG}" && \

View file

@ -1,37 +0,0 @@
import yaml
from varken import VERSION
org = 'boerderij'
project = 'varken'
namespace = "{}/{}".format(org, project)
yaml_arr = []
tags = ['latest', VERSION]
# Docker image, arch, variant, os
arch_list = [('arm', 'arm', 'v6', 'linux'),
('armhf', 'arm', 'v7', 'linux'),
('arm64', 'arm64', 'v8', 'linux'),
('amd64', 'amd64', None, 'linux')]
for tag in tags:
yaml_doc = {
'image': '{}:{}'.format(namespace, tag),
'manifests': []
}
for arch in arch_list:
info = {
'image': "{}:{}-{}".format(namespace, tag, arch[0]),
'platform': {
'architecture': arch[1],
'os': arch[3]
}
}
if arch[2]:
info['platform']['variant'] = arch[2]
yaml_doc['manifests'].append(info)
yaml_arr.append(yaml_doc)
with open(f".manifest.yaml", 'w') as file:
yaml.dump_all(yaml_arr, file, default_flow_style=False)

3
prebuild.sh Normal file
View file

@ -0,0 +1,3 @@
#!/usr/bin/env bash
wget -q "https://github.com/multiarch/qemu-user-static/releases/download/v3.1.0-2/qemu-aarch64-static"
wget -q "https://github.com/multiarch/qemu-user-static/releases/download/v3.1.0-2/qemu-arm-static"

View file

@ -1,2 +1,2 @@
VERSION = "1.6.4"
BRANCH = 'nightly'
BRANCH = 'develop'