Commit 9c6c6d6b authored by ibuler's avatar ibuler

[Feature] 添加Dockerfile

parent b670259a
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
*.pyc *.pyc
*.pyo *.pyo
*.swp *.swp
.env
env env
env* env*
dist dist
...@@ -9,6 +10,7 @@ build ...@@ -9,6 +10,7 @@ build
*.egg *.egg
*.egg-info *.egg-info
_mailinglist _mailinglist
dump.rdb
.tox .tox
.cache/ .cache/
.idea/ .idea/
......
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
\ No newline at end of file
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
\ No newline at end of file
...@@ -280,7 +280,7 @@ REST_FRAMEWORK = { ...@@ -280,7 +280,7 @@ REST_FRAMEWORK = {
'users.authentication.PrivateTokenAuthentication', 'users.authentication.PrivateTokenAuthentication',
'users.authentication.SessionAuthentication', 'users.authentication.SessionAuthentication',
), ),
'DEFAULT_FILTER_BACKENDS': ('django_filters.rest_framework.DjangoFilterBackend',), # 'DEFAULT_FILTER_BACKENDS': ('django_filters.rest_framework.DjangoFilterBackend',),
} }
# Custom User Auth model # Custom User Auth model
......
...@@ -12,7 +12,7 @@ from rest_framework.decorators import api_view ...@@ -12,7 +12,7 @@ from rest_framework.decorators import api_view
from rest_framework.permissions import AllowAny from rest_framework.permissions import AllowAny
from rest_framework.authentication import SessionAuthentication from rest_framework.authentication import SessionAuthentication
from rest_framework_bulk import BulkModelViewSet 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.mixins import IDInFilterMixin
from common.utils import get_logger from common.utils import get_logger
...@@ -30,7 +30,7 @@ class UserViewSet(IDInFilterMixin, BulkModelViewSet): ...@@ -30,7 +30,7 @@ class UserViewSet(IDInFilterMixin, BulkModelViewSet):
queryset = User.objects.all() queryset = User.objects.all()
serializer_class = serializers.UserSerializer serializer_class = serializers.UserSerializer
permission_classes = (IsSuperUser,) permission_classes = (IsSuperUser,)
filter_backends = (DjangoFilterBackend,) # filter_backends = (DjangoFilterBackend,)
filter_fields = ('username', 'email', 'name', 'id') filter_fields = ('username', 'email', 'name', 'id')
......
...@@ -56,7 +56,7 @@ class Config: ...@@ -56,7 +56,7 @@ class Config:
# When Django start it will bind this host and port # When Django start it will bind this host and port
# ./manage.py runserver 127.0.0.1:8080 # ./manage.py runserver 127.0.0.1:8080
# Todo: Gunicorn or uwsgi run may be use it # 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 HTTP_LISTEN_PORT = 8080
# Use Redis as broker for celery and web socket # Use Redis as broker for celery and web socket
......
...@@ -6,17 +6,17 @@ djangorestframework==3.5.3 ...@@ -6,17 +6,17 @@ djangorestframework==3.5.3
ForgeryPy==0.1 ForgeryPy==0.1
openpyxl==2.4.0 openpyxl==2.4.0
celery==3.1.23 celery==3.1.23
paramiko==2.0.2
ansible==2.1.2.0 ansible==2.1.2.0
django-simple-captcha==0.5.2 django-simple-captcha==0.5.2
django-formtools==1.0 django-formtools==1.0
sshpubkeys==2.2.0 sshpubkeys==2.2.0
djangorestframework-bulk==0.2.1 djangorestframework-bulk==0.2.1
paramiko==2.0.2
django-redis-cache==1.7.1 django-redis-cache==1.7.1
requests==2.11.1 requests==2.11.1
itsdangerous==0.24 itsdangerous==0.24
python-gssapi==0.6.4 #python-gssapi==0.6.4
tornado==4.4.2 tornado==4.4.2
eventlet==0.19.0 eventlet==0.19.0
unicodecsv==0.14.1 #unicodecsv==0.14.1
django-filter==1.0.0 #django-filter==1.0.0
...@@ -19,7 +19,7 @@ apps_dir = os.path.join(BASE_DIR, 'apps') ...@@ -19,7 +19,7 @@ apps_dir = os.path.join(BASE_DIR, 'apps')
def start_django(): 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' http_port = CONFIG.HTTP_LISTEN_PORT or '8080'
os.chdir(apps_dir) os.chdir(apps_dir)
print('start django') print('start django')
......
daemonize yes
port 6379
logfile "/opt/jumpserver/logs/redis.log"
dir /opt/jumpserver/
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment