Skip to content

Commit

Permalink
rollback buildx (#134)
Browse files Browse the repository at this point in the history
* buildx looks great and multi-arch support is also desirable, but
  unfortunately, it was difficult for me to maintain, and I couldn't
  seem to harness help from others in the community
* in order to support this project long-term, and without support from
  other members of the community, I need to trade-off features for
  simplicity and maintainability
* I therefore decided to remove buildx / multi-arch suppor for now
  • Loading branch information
gingerlime committed Jun 13, 2023
1 parent f5535dd commit 40aa7d9
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 74 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
echo "VERSION=$(cat thumbor/requirements.txt| grep thumbor== | cut -d= -f 3)" >> $GITHUB_OUTPUT
- name: build images and load them for testing
run: |
./build --extra "--load --cache-from=type=gha,scope=build --cache-to=type=gha,scope=build" --branch "${GITHUB_REF_NAME}"
./build
- name: install bats
run: |
git clone https://github.com/bats-core/bats-core.git
Expand All @@ -48,4 +48,4 @@ jobs:
- name: push when master
if: github.ref == 'refs/heads/master'
run: |
./build --extra "--cache-from=type=gha,scope=build" --multiarch --push --branch master
./push
103 changes: 31 additions & 72 deletions build
Original file line number Diff line number Diff line change
@@ -1,82 +1,41 @@
#!/bin/bash
set -e

PLATFORM="linux/amd64"
EXTRA_ARGUMENTS=""
while true; do
case "$1" in
### Push requires authentication to minimalcompact docker hub
-p | --push)
EXTRA_ARGUMENTS="${EXTRA_ARGUMENTS} --push"
shift
;;
-b | --branch)
BRANCH="$2";
shift 2
;;
### Images have issues building multi arch, so hold behind a feature flag
-m | --multiarch)
PLATFORM="${PLATFORM},linux/arm64"
shift
;;
## Create should be run once, or in ci, if docker buildx ls doesnt contain supported platforms
-c | --create)
docker buildx create --use
shift
;;
-e | --extra )
EXTRA_ARGUMENTS="${EXTRA_ARGUMENTS} $2"
shift 2
;;
* ) break ;;
esac
done

THUMBOR_VERSION=$(cat thumbor/requirements.txt| grep thumbor== | cut -d= -f 3)

docker buildx version
echo "Branch: ${BRANCH} | Thumbor version: ${THUMBOR_VERSION} | Platform: ${PLATFORM} | Extra Arguments: ${EXTRA_ARGUMENTS}"
echo "*******************************************************"

echo "--> BUILDING minimalcompact/thumbor-nginx-proxy-cache"
[ "$BRANCH" == "master" ] && EXTRA_TAG="--tag ghcr.io/minimalcompact/thumbor-nginx-proxy-cache:latest"
docker buildx build $EXTRA_ARGUMENTS --platform $PLATFORM -f nginx-proxy-cache/Dockerfile \
--tag ghcr.io/minimalcompact/thumbor-nginx-proxy-cache:test \
--tag ghcr.io/minimalcompact/thumbor-nginx-proxy-cache:$THUMBOR_VERSION \
$EXTRA_TAG \
nginx-proxy-cache/

echo "--> BUILDING minimalcompact/thumbor"
[ "$BRANCH" == "master" ] && EXTRA_TAG="--tag ghcr.io/minimalcompact/thumbor:latest"
docker buildx build $EXTRA_ARGUMENTS --platform $PLATFORM -f thumbor/Dockerfile \
--tag ghcr.io/minimalcompact/thumbor:test \
--tag ghcr.io/minimalcompact/thumbor:$THUMBOR_VERSION \
$EXTRA_TAG \
thumbor/
docker build --pull -f thumbor/Dockerfile -t minimalcompact/thumbor thumbor/
# introspecting version by running the built image
THUMBOR_VERSION=`docker run --rm minimalcompact/thumbor bash -c "pip freeze |grep ^thumbor== | cut -d= -f 3"`
echo "THUMBOR VERSION: $THUMBOR_VERSION"

echo "--> TAGGING minimalcompact/thumbor:$THUMBOR_VERSION"
docker tag minimalcompact/thumbor ghcr.io/minimalcompact/thumbor:$THUMBOR_VERSION
echo "--> TAGGING minimalcompact/thumbor:latest"
docker tag minimalcompact/thumbor ghcr.io/minimalcompact/thumbor:latest

echo "--> BUILDING minimalcompact/thumbor:simd-sse4"
[ "$BRANCH" == "master" ] && EXTRA_TAG="--tag ghcr.io/minimalcompact/thumbor:latest-simd-sse4t"
## SSE doesnt support multi arch
docker buildx build $EXTRA_ARGUMENTS --platform linux/amd64 --build-arg SIMD_LEVEL=sse4 -f thumbor/Dockerfile \
--tag ghcr.io/minimalcompact/thumbor:$THUMBOR_VERSION-simd-sse4 \
$EXTRA_TAG \
thumbor/
docker build --build-arg SIMD_LEVEL=sse4 -f thumbor/Dockerfile -t minimalcompact/thumbor-simd-sse4 thumbor/
echo "--> TAGGING minimalcompact/thumbor:$THUMBOR_VERSION-simd-sse4"
docker tag minimalcompact/thumbor-simd-sse4 ghcr.io/minimalcompact/thumbor:$THUMBOR_VERSION-simd-sse4
echo "--> TAGGING minimalcompact/thumbor:latest-simd-sse4"
docker tag minimalcompact/thumbor-simd-sse4 ghcr.io/minimalcompact/thumbor:latest-simd-sse4

echo "--> BUILDING minimalcompact/thumbor:simd-avx2"
[ "$BRANCH" == "master" ] && EXTRA_TAG="--tag ghcr.io/minimalcompact/thumbor:latest-simd-avx2"
## AVX2 Doesnt support multi arch
docker buildx build $EXTRA_ARGUMENTS --platform linux/amd64 --build-arg SIMD_LEVEL=avx2 -f thumbor/Dockerfile \
--tag ghcr.io/minimalcompact/thumbor:$THUMBOR_VERSION-simd-avx2 \
$EXTRA_TAG \
thumbor/
docker build --build-arg SIMD_LEVEL=avx2 -f thumbor/Dockerfile -t minimalcompact/thumbor-simd-avx2 thumbor/
echo "--> TAGGING minimalcompact/thumbor:$THUMBOR_VERSION-simd-avx2"
docker tag minimalcompact/thumbor-simd-avx2 ghcr.io/minimalcompact/thumbor:$THUMBOR_VERSION-simd-avx2
echo "--> TAGGING minimalcompact/thumbor:latest-simd-avx2"
docker tag minimalcompact/thumbor-simd-avx2 ghcr.io/minimalcompact/thumbor:latest-simd-avx2

echo "--> BUILDING minimalcompact/remotecv"
[ "$BRANCH" == "master" ] && EXTRA_TAG="--tag ghcr.io/minimalcompact/remotecv:latest"
docker buildx build $EXTRA_ARGUMENTS --platform $PLATFORM --build-arg THUMBOR_TAG=$THUMBOR_VERSION -f remotecv/Dockerfile \
--tag ghcr.io/minimalcompact/remotecv:$THUMBOR_VERSION \
$EXTRA_TAG \
remotecv/
echo "--> BUILDING minimalcompact/thumbor-nginx-proxy-cache"
docker build --pull -f nginx-proxy-cache/Dockerfile -t minimalcompact/thumbor-nginx-proxy-cache nginx-proxy-cache/
echo "--> TAGGING minimalcompact/thumbor-nginx-proxy-cache:$THUMBOR_VERSION"
docker tag minimalcompact/thumbor-nginx-proxy-cache ghcr.io/minimalcompact/thumbor-nginx-proxy-cache:$THUMBOR_VERSION
echo "--> TAGGING minimalcompact/thumbor-nginx-proxy-cache:latest"
docker tag minimalcompact/thumbor-nginx-proxy-cache ghcr.io/minimalcompact/thumbor-nginx-proxy-cache:latest

echo "*******************************************************"
echo Docker images:
docker image ls -a
echo "--> BUILDING minimalcompact/remotecv"
docker build --build-arg THUMBOR_TAG=latest -f remotecv/Dockerfile -t minimalcompact/remotecv remotecv/
echo "--> TAGGING minimalcompact/remotecv:$THUMBOR_VERSION"
docker tag minimalcompact/remotecv ghcr.io/minimalcompact/remotecv:$THUMBOR_VERSION
echo "--> TAGGING minimalcompact/remotecv:latest"
docker tag minimalcompact/remotecv ghcr.io/minimalcompact/remotecv:latest
25 changes: 25 additions & 0 deletions push
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/bash

# introspecting version by running the built image
THUMBOR_VERSION=`docker run --rm minimalcompact/thumbor bash -c "pip freeze |grep ^thumbor== | cut -d= -f 3"`
echo "THUMBOR VERSION: $THUMBOR_VERSION"

echo "--> pushing minimalcompact/thumbor:simdsse4"
docker push ghcr.io/minimalcompact/thumbor:latest-simd-sse4
docker push ghcr.io/minimalcompact/thumbor:$THUMBOR_VERSION-simd-sse4

echo "--> pushing minimalcompact/thumbor:simdavx2"
docker push ghcr.io/minimalcompact/thumbor:latest-simd-avx2
docker push ghcr.io/minimalcompact/thumbor:$THUMBOR_VERSION-simd-avx2

echo "--> pushing minimalcompact/thumbor-nginx-proxy-cache"
docker push ghcr.io/minimalcompact/thumbor-nginx-proxy-cache:latest
docker push ghcr.io/minimalcompact/thumbor-nginx-proxy-cache:$THUMBOR_VERSION

echo "--> pushing minimalcompact/remotecv"
docker push ghcr.io/minimalcompact/remotecv:latest
docker push ghcr.io/minimalcompact/remotecv:$THUMBOR_VERSION

echo "--> pushing minimalcompact/thumbor"
docker push ghcr.io/minimalcompact/thumbor:latest
docker push ghcr.io/minimalcompact/thumbor:$THUMBOR_VERSION

0 comments on commit 40aa7d9

Please sign in to comment.