Skip to content

Commit

Permalink
push
Browse files Browse the repository at this point in the history
  • Loading branch information
jaewan7599 committed Dec 31, 2019
1 parent 31c363c commit adef805
Show file tree
Hide file tree
Showing 5 changed files with 148 additions and 0 deletions.
20 changes: 20 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
FROM ubuntu:18.04

ENV LC_ALL C.UTF-8
ENV LANG C.UTF-8
ENV UID 1000
ENV GID 1000

ADD . /opt/policelab-server
WORKDIR /opt/policelab-server

RUN groupadd -g $GID policelab-server && useradd -u $UID -g policelab-server policelab-server

RUN apt update && \
apt install -y python3 python3-pip supervisor && \
rm -rf /var/lib/apt/lists/* && \
pip3 --no-cache-dir install pipenv

RUN pipenv install --system --deploy

ENTRYPOINT supervisord -n -c /etc/supervisor/supervisord.conf
13 changes: 13 additions & 0 deletions Pipfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[[source]]
name = "pypi"
url = "https://pypi.org/simple"
verify_ssl = true

[dev-packages]

[packages]
django = "*"
gunicorn = "*"

[requires]
python_version = "3.7"
58 changes: 58 additions & 0 deletions Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

36 changes: 36 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
version: '3'
services:
nginx:
image: nginx:1.17.6-alpine
ports:
- '80:80'
- '8000:8000'
volumes:
- ${WWW_DIR}:/var/www
- ${NGINX_LOG_DIR}:/var/log/nginx
- ./conf.d/nginx:/etc/nginx/conf.d:ro
depends_on:
- policelab-server

mariadb:
image: mariadb:10.4.11-bionic
volumes:
- ${MARIA_DATA_DIR}:/var/lib/mysql
- ./conf.d/mariadb:/etc/mysql/conf.d:ro
environment:
- 'MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD}'

policelab-server:
build: .
volumes:
- ${WWW_DIR}:/var/www
- ${APP_SRC_DIR}:/opt/policelab-server
- ${SUPERVISOR_LOG_DIR}:/var/log/supervisor
- ./conf.d/supervisor:/etc/supervisor:ro
- /etc/localtime:/etc/localtime:ro
- /etc/timezone:/etc/timezone:ro
environment:
- 'UID=${UID}'
- 'GID=${GID}'
depends_on:
- mariadb
21 changes: 21 additions & 0 deletions manage.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/usr/bin/env python
"""Django's command-line utility for administrative tasks."""
import os
import sys


def main():
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'app.settings')
try:
from django.core.management import execute_from_command_line
except ImportError as exc:
raise ImportError(
"Couldn't import Django. Are you sure it's installed and "
"available on your PYTHONPATH environment variable? Did you "
"forget to activate a virtual environment?"
) from exc
execute_from_command_line(sys.argv)


if __name__ == '__main__':
main()

0 comments on commit adef805

Please sign in to comment.