Skip to content

Instantly share code, notes, and snippets.

@mozhu1024
Created July 8, 2019 07:43
Show Gist options
  • Save mozhu1024/321f1c61f0323345abbef95ab7349549 to your computer and use it in GitHub Desktop.
Save mozhu1024/321f1c61f0323345abbef95ab7349549 to your computer and use it in GitHub Desktop.
[SecurityManageFramwork] Docker for SecurityManageFramwork #docker
version: "2"
services:
app:
build: .
image: virink/semf
command: /app/start.sh
ports:
- "127.0.0.1:8081:8000"
rabbitmq:
image: rabbitmq:3.7-alpine
volumes:
- ./enabled_plugins:/etc/rabbitmq/enabled_plugins
environment:
- RABBITMQ_VM_MEMORY_HIGH_WATERMARK=0.5
- RABBITMQ_ERLANG_COOKIE=rabbitmq_erlang_secret
- RABBITMQ_DEFAULT_VHOST=semf
- RABBITMQ_DEFAULT_USER=semf
- RABBITMQ_DEFAULT_PASS=semf
FROM python:3-alpine3.9
# git clone https://gitee.com/gy071089/SecurityManageFramwork.git
# cd SecurityManageFramwork
COPY . /app/
WORKDIR /app
# TODO: django -> django==2.1.7
RUN python -m pip install -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com -r requirements.txt
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.tuna.tsinghua.edu.cn/' /etc/apk/repositories && \
apk update && \
apk add sqlite nmap
RUN python manage.py makemigrations
RUN python manage.py migrate
# RUN python manage.py createsuperuser --username semf --email semf@secoo.com
RUN echo "from django.contrib.auth.models import User; User.objects.create_superuser('semf', 'semf@example.com', 'm9TwgEtA8TBC')" | python manage.py shell
RUN python initdata.py
CMD ["/app/start.sh"]
[rabbitmq_management].
#!/bin/sh
python -m celery -A SeMF worker -l info --autoscale=10,4 >> logs/celery.log 2>&1 &
echo "Start celery for semf"
python manage.py runserver 0.0.0.0:8000
server {
listen 80;
server_name semf.example.cn;
server_tokens off;
access_log /var/log/nginx/semf_access.log;
error_log /var/log/nginx/semf_error.log;
location / {
proxy_pass http://127.0.0.1:8081/;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment