-
Notifications
You must be signed in to change notification settings - Fork 157
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #111 from pyouroboros/multiarch/fine-tuning
Multiarch/fine tuning
- Loading branch information
Showing
11 changed files
with
140 additions
and
77 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,12 @@ | ||
FROM python:3.7-alpine | ||
FROM amd64/python:3.7.2-alpine | ||
|
||
LABEL maintainers="dirtycajunrice,circa10a,tkdeviant" | ||
|
||
COPY / /app | ||
|
||
WORKDIR /app | ||
COPY . . | ||
|
||
RUN apk add --no-cache tzdata && \ | ||
pip install --no-cache-dir . | ||
ENTRYPOINT ["ouroboros"] | ||
|
||
ENTRYPOINT ["ouroboros"] |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
FROM arm32v6/python:3.7.2-alpine | ||
|
||
LABEL maintainers="dirtycajunrice,circa10a,tkdeviant" | ||
|
||
COPY / /app | ||
|
||
COPY /tmp/qemu-arm-static /usr/bin/qemu-arm-static | ||
|
||
WORKDIR /app | ||
|
||
RUN apk add --no-cache tzdata && \ | ||
pip install --no-cache-dir . | ||
|
||
ENTRYPOINT ["ouroboros"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
FROM arm64v8/python:3.7.2-alpine | ||
|
||
LABEL maintainers="dirtycajunrice,circa10a,tkdeviant" | ||
|
||
COPY / /app | ||
|
||
COPY /tmp/qemu-aarch64-static /usr/bin/qemu-aarch64-static | ||
|
||
WORKDIR /app | ||
|
||
RUN apk add --no-cache tzdata && \ | ||
pip install --no-cache-dir . | ||
|
||
ENTRYPOINT ["ouroboros"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
FROM arm32v7/python:3.7.2-slim | ||
|
||
LABEL maintainers="dirtycajunrice,circa10a,tkdeviant" | ||
|
||
COPY / /app | ||
|
||
COPY /tmp/qemu-arm-static /usr/bin/qemu-arm-static | ||
|
||
WORKDIR /app | ||
|
||
RUN pip install --no-cache-dir . | ||
|
||
ENTRYPOINT ["ouroboros"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,50 +1,96 @@ | ||
#!/usr/bin/env bash | ||
VERSION="$(grep -i version ./pyouroboros/__init__.py | awk -F= '{gsub("\047",""); gsub(",",""); print $2}')" | ||
# Travis-ci convenience environment vars used: | ||
# TRAVIS_BRANCH | branch name | ||
# $TRAVIS_REPO_SLUG | organization/project (GitHub Capitalization) | ||
# Travis-ci manual environment vars used: | ||
# GITHUB_USER | github username | ||
# GITHUB_TOKEN | $GITHUB_USER's token | ||
# DOCKER_USER | docker username | ||
# DOCKER_PASSWORD | $DOCKER_USER's password | ||
|
||
# Docker | ||
GITHUB_USER='pyouroboros-bot' | ||
DOCKER_USER='pyouroborosbot' | ||
PROJECT='ouroboros' | ||
NAMESPACE="pyouroboros/${PROJECT}" | ||
VERSION="$(grep -i version pyouroboros/__init__.py | cut -d' ' -f3 | tr -d \")" | ||
|
||
# Set branch to latest if master, else keep the same | ||
if [[ "$TRAVIS_BRANCH" == "master" ]]; then | ||
BRANCH="latest" | ||
else | ||
BRANCH="$TRAVIS_BRANCH" | ||
fi | ||
|
||
# get the docker lowercase variant of the repo_name | ||
REPOSITORY="$(echo $TRAVIS_REPO_SLUG | tr '[:upper:]' '[:lower:]')" | ||
|
||
# Docker experimental config | ||
echo '{"experimental":true}' | sudo tee /etc/docker/daemon.json | ||
[ -d ~/.docker ] || mkdir ~/.docker | ||
[ -f ~/.docker/config.json ] || touch ~/.docker/config.json | ||
[[ -d ~/.docker ]] || mkdir ~/.docker | ||
[[ -f ~/.docker/config.json ]] || touch ~/.docker/config.json | ||
echo '{"experimental":"enabled"}' | sudo tee ~/.docker/config.json | ||
sudo service docker restart | ||
|
||
# Auth | ||
echo $DOCKER_PASSWORD | docker login -u="$DOCKER_USER" --password-stdin | ||
|
||
# Latest x64 | ||
docker build -t "${NAMESPACE}:latest" . && \ | ||
docker push "${NAMESPACE}:latest" && \ | ||
# Versioned x64 | ||
docker tag "${NAMESPACE}:latest" "${NAMESPACE}:${VERSION}" && \ | ||
docker push "${NAMESPACE}:${VERSION}" && \ | ||
# x64 Arch | ||
docker tag "${NAMESPACE}:latest" "${NAMESPACE}:latest-amd64" && \ | ||
docker push "${NAMESPACE}:latest-amd64" | ||
|
||
# Prepare qemu for ARM builds | ||
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 | ||
|
||
# Set tag based off of branch | ||
if [[ "$BRANCH" == "latest" ]]; then | ||
TAG="$VERSION" | ||
else | ||
TAG="$BRANCH" | ||
fi | ||
|
||
# ARM images | ||
for i in $(ls *.rpi); do | ||
arch="$(echo ${i} | cut -d- -f2 | cut -d. -f1)" | ||
# Latest | ||
docker build -f "./Dockerfile-${arch}.rpi" -t "${NAMESPACE}:latest-${arch}-rpi" . && \ | ||
docker push "${NAMESPACE}:latest-${arch}-rpi" && \ | ||
# Versioned | ||
docker tag "${NAMESPACE}:latest-${arch}-rpi" "${NAMESPACE}:${VERSION}-${arch}-rpi" && \ | ||
docker push "${NAMESPACE}:${VERSION}-${arch}-rpi" | ||
# AMDx64 | ||
docker build -t "${REPOSITORY}:${TAG}-amd64" . && \ | ||
docker push "${REPOSITORY}:${TAG}-amd64" | ||
|
||
# Create Initial Manifests | ||
docker manifest create "${REPOSITORY}:${BRANCH}" "${REPOSITORY}:${BRANCH}-amd64" | ||
if [[ "$BRANCH" == "latest" ]]; then | ||
docker manifest create "${REPOSITORY}:${TAG}" "${REPOSITORY}:${TAG}-amd64" | ||
fi | ||
|
||
# ARM variants | ||
for i in $(ls *arm*); do | ||
ARCH="$(echo ${i} | cut -d. -f2)" | ||
docker build -t "${REPOSITORY}:${TAG}-${ARCH}" && \ | ||
docker push "${REPOSITORY}:${TAG}-${ARCH}" | ||
# Add variant to manifest | ||
docker manifest create -a "${REPOSITORY}:${BRANCH}" "${REPOSITORY}:${BRANCH}-${ARCH}" | ||
if [[ "$BRANCH" == "latest" ]]; then | ||
docker manifest create -a "${REPOSITORY}:${TAG}" "${REPOSITORY}:${TAG}-${ARCH}" | ||
fi | ||
if [[ "$ARCH" == "arm64" ]]; then | ||
docker annotate "${REPOSITORY}:${BRANCH}" "${REPOSITORY}:${BRANCH}-${ARCH}" --variant v8 | ||
if [[ "$BRANCH" == "latest" ]]; then | ||
docker annotate "${REPOSITORY}:${TAG}" "${REPOSITORY}:${TAG}-${ARCH}" --variant v8 | ||
fi | ||
elif [[ "$ARCH" == "armhf" ]]; then | ||
docker annotate "${REPOSITORY}:${BRANCH}" "${REPOSITORY}:${BRANCH}-${ARCH}" --variant v7 | ||
if [[ "$BRANCH" == "latest" ]]; then | ||
docker annotate "${REPOSITORY}:${TAG}" "${REPOSITORY}:${TAG}-${ARCH}" --variant v7 | ||
fi | ||
elif [[ "$ARCH" == "arm" ]]; then | ||
docker annotate "${REPOSITORY}:${BRANCH}" "${REPOSITORY}:${BRANCH}-${ARCH}" --variant v6 | ||
if [[ "$BRANCH" == "latest" ]]; then | ||
docker annotate "${REPOSITORY}:${TAG}" "${REPOSITORY}:${TAG}-${ARCH}" --variant v6 | ||
fi | ||
fi | ||
done | ||
|
||
wget -O manifest-tool https://github.com/estesp/manifest-tool/releases/download/v0.9.0/manifest-tool-linux-amd64 && \ | ||
chmod +x manifest-tool && \ | ||
./manifest-tool --username "$USER" --password "$docker_password" push from-spec "${USER}-${PROJECT}.yaml" | ||
docker manifest inspect "${REPOSITORY}:${BRANCH}" && \ | ||
docker manifest push "${REPOSITORY}:${BRANCH}" | ||
if [[ "$BRANCH" == "latest" ]]; then | ||
docker manifest inspect "${REPOSITORY}:${TAG}" && \ | ||
docker manifest push "${REPOSITORY}:${TAG}" | ||
fi | ||
|
||
# Git tags | ||
git remote set-url origin "https://${GITHUB_USER}:${GITHUB_API_KEY}@github.com/${NAMESPACE}.git" && \ | ||
git tag "${VERSION}" && \ | ||
git push --tags | ||
if [[ "$BRANCH" == "latest" ]]; then | ||
git remote set-url origin "https://${GITHUB_USER}:${GITHUB_TOKEN}@github.com/${REPOSITORY}.git" && \ | ||
git tag "${VERSION}" && \ | ||
git push --tags | ||
fi |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters