forked from openwisp/openwisp-controller
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[docker] Updated docker setup to work with the new version
- Loading branch information
Showing
4 changed files
with
63 additions
and
22 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,30 @@ | ||
FROM python:3-onbuild | ||
FROM python:3.7-alpine | ||
|
||
WORKDIR . | ||
RUN apt-get update && apt-get install -y \ | ||
openssl \ | ||
sqlite3 \ | ||
libsqlite3-dev \ | ||
libssl-dev \ | ||
gdal-bin \ | ||
libproj-dev \ | ||
libgeos-dev \ | ||
libspatialite-dev | ||
RUN pip3 install -U pip setuptools wheel | ||
RUN pip3 install -U . | ||
RUN echo "openwisp-controller installed" | ||
WORKDIR tests/ | ||
CMD ["./docker-entrypoint.sh"] | ||
WORKDIR /opt/openwisp/ | ||
CMD ["sh", "docker-entrypoint.sh"] | ||
EXPOSE 8000 | ||
ENV NAME=openwisp-controller \ | ||
PYTHONBUFFERED=1 | ||
|
||
ENV NAME openwisp-controller | ||
RUN apk add --no-cache \ | ||
--update zlib-dev jpeg-dev libffi-dev gettext gcc openssl tzdata && \ | ||
apk add --no-cache \ | ||
--repository http://dl-cdn.alpinelinux.org/alpine/edge/testing \ | ||
--update geos-dev gdal-dev libspatialite && \ | ||
apk add --no-cache \ | ||
--update \ | ||
--virtual .build-deps postgresql-dev git build-base linux-headers openssl-dev | ||
|
||
RUN pip install django-netjsonconfig openwisp-utils scp celery asgi_redis \ | ||
django-loci paramiko openwisp-users cryptography==2.3.1 \ | ||
djangorestframework-gis redis service_identity django-redis | ||
|
||
ADD . /opt/openwisp | ||
|
||
RUN pip install -U . && \ | ||
pip install https://github.com/openwisp/openwisp-users/tarball/master && \ | ||
pip install https://github.com/openwisp/django-netjsonconfig/tarball/master && \ | ||
pip install https://github.com/openwisp/django-x509/tarball/master && \ | ||
pip install https://github.com/openwisp/openwisp-utils/tarball/master | ||
|
||
WORKDIR /opt/openwisp/tests/ |
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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
version: "3" | ||
|
||
services: | ||
controller: | ||
image: openwisp/controller-development:latest | ||
build: | ||
context: . | ||
ports: | ||
- 8000:8000 | ||
depends_on: | ||
- redis | ||
|
||
redis: | ||
image: redis:alpine |
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,5 +1,22 @@ | ||
#!/bin/bash | ||
|
||
python3 manage.py migrate | ||
python3 manage.py createsuperuser | ||
python3 manage.py runserver 0.0.0.0:8000 | ||
create_superuser () { | ||
local username="$1" | ||
local email="$2" | ||
local password="$3" | ||
cat <<EOF | python manage.py shell | ||
from django.contrib.auth import get_user_model | ||
User = get_user_model() | ||
if not User.objects.filter(username="$username").exists(): | ||
User.objects.create_superuser("$username", "$email", "$password") | ||
else: | ||
print('User "{}" exists already, not created'.format("$username")) | ||
EOF | ||
} | ||
|
||
python manage.py migrate --no-input | ||
create_superuser admin admin@example.com admin | ||
celery -A openwisp2 worker -l info & \ | ||
python manage.py runserver 0.0.0.0:8000 |