Add support for docker build + docker release

This commit is contained in:
Nico Schottelius 2021-12-17 22:21:59 +01:00
parent c0333212aa
commit 8179ca4d22
5 changed files with 32 additions and 3 deletions

1
.dockerignore Normal file
View file

@ -0,0 +1 @@
.git

View file

@ -5,8 +5,9 @@ WORKDIR /usr/src/app
RUN apk add --update --no-cache \
git \
build-base \
openldap-dev\
python3-dev\
openldap-dev \
python3-dev \
libpq-dev \
&& rm -rf /var/cache/apk/*
# FIX https://github.com/python-ldap/python-ldap/issues/432

View file

@ -14,6 +14,12 @@ help:
@echo ' make rsync_upload '
@echo ' make install_debian_packages '
buildimage:
docker build -t dynamicweb:$$(git describe) .
releaseimage: buildimage
./release.sh
collectstatic:
$(PY?) $(BASEDIR)/manage.py collectstatic

21
release.sh Executable file
View file

@ -0,0 +1,21 @@
#!/bin/sh
# Nico Schottelius, 2021-12-17
current=$(git describe --dirty)
last_tag=$(git describe --tags --abbrev=0)
registry=harbor.ungleich.svc.p10.k8s.ooo/ungleich-public
image_url=$registry/dynamicweb:${current}
if echo $current | grep -q -e 'dirty$'; then
echo Refusing to release a dirty tree build
exit 1
fi
if [ "$current" != "$last_tag" ]; then
echo "Last tag ($last_tag) is not current version ($current)"
echo "Only release proper versions"
exit 1
fi
docker tag dynamicweb:${current} ${image_url}
docker push ${image_url}

View file

@ -25,7 +25,7 @@ django-compressor==2.0
django-debug-toolbar==1.4
python-dotenv==0.10.3
django-extensions==1.6.7
django-filer==1.2.0
django-filer==2.1.2
django-filter==0.13.0
django-formtools==1.0
django-guardian==1.4.4