[Feature] 添加Dockerfile

pull/530/head
ibuler 2017-01-07 20:07:33 +08:00
parent b670259ab6
commit 9c6c6d6b4c
9 changed files with 36 additions and 9 deletions

2
.gitignore vendored
View File

@ -2,6 +2,7 @@
*.pyc
*.pyo
*.swp
.env
env
env*
dist
@ -9,6 +10,7 @@ build
*.egg
*.egg-info
_mailinglist
dump.rdb
.tox
.cache/
.idea/

12
Dockerfile Normal file
View File

@ -0,0 +1,12 @@
FROM jumpserver/base-env-alpine:latest
MAINTAINER Jumpserver Team <ibuler@qq.com>
#RUN apk add --update python gcc python-dev py-pip musl-dev linux-headers \
# libffi-dev openssl-dev jpeg-dev redis && rm -rf /var/cache/apk/*
COPY . /opt/jumpserver
WORKDIR /opt/jumpserver
#RUN pip install -r requirements.txt -i https://pypi.doubanio.com/simple
RUN rm -f db.sqlite3 && cd utils && sh make_migrations.sh && sh init_db.sh
EXPOSE 8080
CMD redis-server utils/redis.conf && python run_server.py

View File

@ -0,0 +1,9 @@
FROM alpine:3.4
MAINTAINER Jumpserver Team <ibuler@qq.com>
RUN apk add --update python gcc python-dev py-pip musl-dev linux-headers \
libffi-dev openssl-dev jpeg-dev freetype-dev redis && rm -rf /var/cache/apk/*
COPY ./requirements.txt /tmp
WORKDIR /tmp
RUN pip install -r requirements.txt -i https://pypi.doubanio.com/simple

View File

@ -280,7 +280,7 @@ REST_FRAMEWORK = {
'users.authentication.PrivateTokenAuthentication',
'users.authentication.SessionAuthentication',
),
'DEFAULT_FILTER_BACKENDS': ('django_filters.rest_framework.DjangoFilterBackend',),
# 'DEFAULT_FILTER_BACKENDS': ('django_filters.rest_framework.DjangoFilterBackend',),
}
# Custom User Auth model

View File

@ -12,7 +12,7 @@ from rest_framework.decorators import api_view
from rest_framework.permissions import AllowAny
from rest_framework.authentication import SessionAuthentication
from rest_framework_bulk import BulkModelViewSet
from django_filters.rest_framework import DjangoFilterBackend
# from django_filters.rest_framework import DjangoFilterBackend
from common.mixins import IDInFilterMixin
from common.utils import get_logger
@ -30,7 +30,7 @@ class UserViewSet(IDInFilterMixin, BulkModelViewSet):
queryset = User.objects.all()
serializer_class = serializers.UserSerializer
permission_classes = (IsSuperUser,)
filter_backends = (DjangoFilterBackend,)
# filter_backends = (DjangoFilterBackend,)
filter_fields = ('username', 'email', 'name', 'id')

View File

@ -56,7 +56,7 @@ class Config:
# When Django start it will bind this host and port
# ./manage.py runserver 127.0.0.1:8080
# Todo: Gunicorn or uwsgi run may be use it
HTTP_BIND_HOST = '127.0.0.1'
HTTP_BIND_HOST = '0.0.0.0'
HTTP_LISTEN_PORT = 8080
# Use Redis as broker for celery and web socket

View File

@ -6,17 +6,17 @@ djangorestframework==3.5.3
ForgeryPy==0.1
openpyxl==2.4.0
celery==3.1.23
paramiko==2.0.2
ansible==2.1.2.0
django-simple-captcha==0.5.2
django-formtools==1.0
sshpubkeys==2.2.0
djangorestframework-bulk==0.2.1
paramiko==2.0.2
django-redis-cache==1.7.1
requests==2.11.1
itsdangerous==0.24
python-gssapi==0.6.4
#python-gssapi==0.6.4
tornado==4.4.2
eventlet==0.19.0
unicodecsv==0.14.1
django-filter==1.0.0
#unicodecsv==0.14.1
#django-filter==1.0.0

View File

@ -19,7 +19,7 @@ apps_dir = os.path.join(BASE_DIR, 'apps')
def start_django():
http_host = CONFIG.HTTP_LISTEN_HOST or '127.0.0.1'
http_host = CONFIG.HTTP_BIND_HOST or '127.0.0.1'
http_port = CONFIG.HTTP_LISTEN_PORT or '8080'
os.chdir(apps_dir)
print('start django')

4
utils/redis.conf Normal file
View File

@ -0,0 +1,4 @@
daemonize yes
port 6379
logfile "/opt/jumpserver/logs/redis.log"
dir /opt/jumpserver/