Compare commits

...

15 Commits

Author SHA1 Message Date
pcoder116 0679a47eea Merge branch 'master' into 12334-generic-products-name-in-invoice 2024-03-21 02:42:56 +00:00
Nico Schottelius 8b08357d05 entrypoint: make executable 2024-02-20 17:19:05 +09:00
Nico Schottelius 8b06c2c6e9 docker: add entrypoint and add support for dynamic config 2024-02-20 17:18:29 +09:00
Nico Schottelius 26f3a1881d make build image only push if push is specified 2024-02-20 16:25:13 +09:00
nico14571 dee2b1a90c Merge pull request 'make-docker-build-succesful' (#19) from make-docker-build-succesful into master
Reviewed-on: #19
2024-02-20 01:06:22 +00:00
PCoder 9e98125b13 Use the same django-filer version being used on production 2024-02-19 20:50:36 +05:30
PCoder 8d13629c8b Use proper library path for Pillow 2024-02-19 20:49:29 +05:30
PCoder b6ff2b62c1 Add comment for alpine 3.14 requirement 2024-02-19 20:44:17 +05:30
PCoder 893c816846 Add apks required for the build on alpine 3.12 2024-02-19 20:43:41 +05:30
PCoder f178be8395 Update .dockerignore: ignore .env 2024-02-19 20:42:34 +05:30
Nico Schottelius 0d7f10776c [docker] push if build is ok 2024-02-17 20:49:31 +09:00
Nico Schottelius 4eb470df16 [docker] switch to python 3.5 2024-02-17 20:48:17 +09:00
app@dynamicweb-production 6262432b7a Merge remote-tracking branch 'ungleich/master' 2024-02-17 11:21:58 +01:00
app@dynamicweb-production bd4d81c286 Show virtual machine plan page for admin 2024-02-17 11:20:12 +01:00
Nico Schottelius 169dc6b1ee Add initial script for image building 2024-02-17 18:27:44 +09:00
7 changed files with 73 additions and 5 deletions

View File

@ -1 +1,2 @@
.git
.env

View File

@ -1,4 +1,5 @@
FROM python:3.10.0-alpine3.15
# FROM python:3.10.0-alpine3.15
FROM python:3.5-alpine3.12
WORKDIR /usr/src/app
@ -7,12 +8,25 @@ RUN apk add --update --no-cache \
build-base \
openldap-dev \
python3-dev \
libpq-dev \
postgresql-dev \
jpeg-dev \
libxml2-dev \
libxslt-dev \
libmemcached-dev \
zlib-dev \
&& rm -rf /var/cache/apk/*
## For alpine 3.15 replace postgresql-dev with libpq-dev
# FIX https://github.com/python-ldap/python-ldap/issues/432
RUN echo 'INPUT ( libldap.so )' > /usr/lib/libldap_r.so
COPY requirements.txt ./
RUN pip install --no-cache-dir -r requirements.txt
# Pillow seems to need LIBRARY_PATH set as follows: (see: https://github.com/python-pillow/Pillow/issues/1763#issuecomment-222383534)
RUN LIBRARY_PATH=/lib:/usr/lib /bin/sh -c "pip install --no-cache-dir -r requirements.txt"
COPY ./ .
COPY entrypoint.sh /
ENTRYPOINT ["/entrypoint.sh" ]

23
build-image.sh Executable file
View File

@ -0,0 +1,23 @@
#!/bin/sh
if [ $# -lt 1 ]; then
echo "$0 imageversion [push]"
echo "Version could be: $(git describe --always)"
echo "If push is specified, also push to our harbor"
exit 1
fi
tagprefix=harbor.k8s.ungleich.ch/ungleich-public/dynamicweb
version=$1; shift
tag=${tagprefix}:${version}
set -ex
docker build -t "${tag}" .
push=$1; shift
if [ "$push" ]; then
docker push "${tag}"
fi

View File

@ -777,3 +777,9 @@ if DEBUG:
from .local import * # flake8: noqa
else:
from .prod import * # flake8: noqa
# Try to load dynamic configuration, if it exists
try:
from .dynamic import * # flake8: noqa
except ImportError:
pass

19
entrypoint.sh Executable file
View File

@ -0,0 +1,19 @@
#!/bin/sh
set -uex
cd /usr/src/app/
cat > dynamicweb/settings/dynamic.py <<EOF
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': '${POSTGRES_DB}',
'USER': '${POSTGRES_USER}',
'PASSWORD': '${POSTGRES_PASSWORD}',
'HOST': '${POSTGRES_HOST}',
'PORT': '5432',
}
}
EOF
exec "$@"

View File

@ -1544,7 +1544,12 @@ class VirtualMachinesPlanListView(LoginRequiredMixin, ListView):
ordering = '-id'
def get_queryset(self):
owner = self.request.user
username = self.request.GET.get('username')
if self.request.user.is_admin and username:
user = CustomUser.objects.get(username=username)
else:
user = self.request.user
owner = user
manager = OpenNebulaManager(email=owner.username,
password=owner.password)
try:

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==2.1.2
django-filer==1.2.0
django-filter==0.13.0
django-formtools==1.0
django-guardian==1.4.4