Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: upgrade base image #35

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 12 additions & 44 deletions .github/workflows/development.yaml
Original file line number Diff line number Diff line change
@@ -1,65 +1,48 @@
name: Development
on:
push:
pull_request:
tags:
- '*.*.*'
# pull_request:
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
include:
- distro: alpine
conda_ver: '22.11.1'
conda_ver: '23.5.2'
py_ver: '3.11'
platform: linux/amd64
- distro: alpine
conda_ver: '22.11.1'
conda_ver: '23.5.2'
py_ver: '3.10'
platform: linux/amd64
- distro: alpine
conda_ver: '22.11.1'
conda_ver: '23.5.2'
py_ver: '3.9'
platform: linux/amd64
- distro: alpine
conda_ver: '22.11.1'
conda_ver: '23.5.2'
py_ver: '3.8'
platform: linux/amd64
- distro: alpine
conda_ver: '22.11.1'
py_ver: '3.7'
platform: linux/amd64
- distro: debian
conda_ver: '22.11.1'
conda_ver: '23.5.2'
py_ver: '3.11'
platform: linux/amd64
- distro: debian
conda_ver: '22.11.1'
conda_ver: '23.5.2'
py_ver: '3.10'
platform: linux/amd64
- distro: debian
conda_ver: '22.11.1'
conda_ver: '23.5.2'
py_ver: '3.9'
platform: linux/amd64
- distro: debian
conda_ver: '22.11.1'
conda_ver: '23.5.2'
py_ver: '3.8'
platform: linux/amd64
- distro: debian
conda_ver: '22.11.1'
py_ver: '3.7'
platform: linux/amd64
# - distro: debian
# conda_ver: 4.10.3
# py_ver: 3.9
# platform: linux/arm64
# - distro: debian
# conda_ver: 4.10.3
# py_ver: 3.8
# platform: linux/arm64
# - distro: debian
# conda_ver: 4.10.3
# py_ver: 3.7
# platform: linux/arm64
env:
DISTRO: ${{matrix.distro}}
CONDA_VER: ${{matrix.conda_ver}}
Expand Down Expand Up @@ -110,9 +93,6 @@ jobs:
- distro: alpine
py_ver: '3.8'
platform: linux/amd64
- distro: alpine
py_ver: '3.7'
platform: linux/amd64
- distro: debian
py_ver: '3.11'
platform: linux/amd64
Expand All @@ -125,18 +105,6 @@ jobs:
- distro: debian
py_ver: '3.8'
platform: linux/amd64
- distro: debian
py_ver: '3.7'
platform: linux/amd64
# - distro: debian
# py_ver: 3.9
# platform: linux/arm64
# - distro: debian
# py_ver: 3.8
# platform: linux/arm64
# - distro: debian
# py_ver: 3.7
# platform: linux/arm64
env:
DISTRO: ${{matrix.distro}}
PY_VER: ${{matrix.py_ver}}
Expand Down
12 changes: 6 additions & 6 deletions config/.env
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
## build

# PY_VER='3.11'
# CONDA_VER=22.11.1
# CONDA_VER=23.5.2

PY_VER='3.10'
CONDA_VER=22.11.1
CONDA_VER=23.5.2

# PY_VER=3.9
# CONDA_VER=22.11.1
# CONDA_VER=23.5.2

# PY_VER=3.8
# CONDA_VER=22.11.1
# CONDA_VER=23.5.2

# PY_VER=3.7
# CONDA_VER=22.11.1
# CONDA_VER=23.5.2

BASE_IMAGE_HASH=270a9fc
BASE_IMAGE_HASH=3206516



Expand Down
41 changes: 16 additions & 25 deletions tests/main.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,32 +44,23 @@ TAG=$(echo $REF | awk -F':' '{print $2}')
IMAGE=$(echo $REF | awk -F':' '{print $1}')
SHELL_CMD_TEMPLATE="docker run --rm -i \$SHELL_CMD_FLAGS $REF \
$(docker inspect "$REF" --format '{{join .Config.Cmd " "}}') -c"
# determine reference size
if [ $DISTRO == alpine ] && [ $PY_VER == '3.11' ] && [ $PLATFORM == 'linux/amd64' ]; then
SIZE_LIMIT=774
elif [ $DISTRO == alpine ] && [ $PY_VER == '3.10' ] && [ $PLATFORM == 'linux/amd64' ]; then
SIZE_LIMIT=543
elif [ $DISTRO == alpine ] && [ $PY_VER == '3.9' ] && [ $PLATFORM == 'linux/amd64' ]; then
SIZE_LIMIT=533
elif [ $DISTRO == alpine ] && [ $PY_VER == '3.8' ] && [ $PLATFORM == 'linux/amd64' ]; then
SIZE_LIMIT=516
elif [ $DISTRO == alpine ] && [ $PY_VER == '3.7' ] && [ $PLATFORM == 'linux/amd64' ]; then
SIZE_LIMIT=481
elif [ $DISTRO == debian ] && [ $PY_VER == '3.11' ] && [ $PLATFORM == 'linux/amd64' ]; then
SIZE_LIMIT=897
elif [ $DISTRO == debian ] && [ $PY_VER == '3.10' ] && [ $PLATFORM == 'linux/amd64' ]; then
SIZE_LIMIT=666
elif [ $DISTRO == debian ] && [ $PY_VER == '3.9' ] && [ $PLATFORM == 'linux/amd64' ]; then
SIZE_LIMIT=655
elif [ $DISTRO == debian ] && [ $PY_VER == '3.8' ] && [ $PLATFORM == 'linux/amd64' ]; then
SIZE_LIMIT=638
elif [ $DISTRO == debian ] && [ $PY_VER == '3.7' ] && [ $PLATFORM == 'linux/amd64' ]; then
SIZE_LIMIT=603
fi
SIZE_LIMIT=$(echo "scale=4; $SIZE_LIMIT * 1.05" | bc)
# verify size minimal
SIZE=$(docker images --filter "reference=$REF" --format "{{.Size}}" | awk -F'MB' '{print $1}')
# Get the compressed size of the last build from docker hub
LAST_BUILD_SIZE=$(curl -s https://hub.docker.com/v2/repositories/$IMAGE/tags \
| jq -r '.results[] | select(.name=="py'"$PY_VER"'-'"$DISTRO"'") | .images[0].size')
SIZE_INCRESE_FACTOR=1.5
SIZE_LIMIT=$(echo "scale=4; $LAST_BUILD_SIZE * $SIZE_INCRESE_FACTOR" | bc)
# Verify size minimal
echo Compressing image for size verification...
docker save $REF | gzip > /tmp/$TAG.tar.gz
SIZE=$(ls -al /tmp | grep $TAG.tar.gz | awk '{ print $5 }')
echo -e \
Size comparison:\\n\
Current size: $(numfmt --to iec --format "%8.4f" $SIZE)\\n\
Last build size: $(numfmt --to iec --format "%8.4f" $LAST_BUILD_SIZE)\\n\
Size factor: $SIZE_INCRESE_FACTOR\\n\
Size limit: $(numfmt --to iec --format "%8.4f" $SIZE_LIMIT)
assert "minimal footprint" "(( $(echo "$SIZE <= $SIZE_LIMIT" | bc -l) ))" $LINENO
rm /tmp/$TAG.tar.gz
# run tests
SHELL_CMD=$(eval "echo \"$SHELL_CMD_TEMPLATE\"")
validate