Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pokr.kr Dockerize #57

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .env.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
DB_NAME=
DB_USER=
DB_PASSWORD=

NGINX_SERVING_PORT=
27 changes: 27 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
FROM python:2
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

기왕 하시는 김에 python 3.7 기준으로 해보는 것이 어떠세요?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

작업중이신 브랜치 베이스로 바꿔볼게요.


ENV PYTHONIOENCODING='UTF-8'
ENV LANG=en_US.UTF-8
ENV LANGUAGE=en_US.UTF-8
ENV LC_ALL=en_US.UTF-8

RUN apt-get update && apt-get install -y git wget && rm -rf /var/lib/apt/lists/*
RUN mkdir -p /pokr.kr && \
mkdir ~/.pip && echo '[global]\n\
index-url=http://mirror.kakao.com/pypi/simple/\n\
trusted-host=mirror.kakao.com' > ~/.pip/pip.conf

WORKDIR /pokr.kr
ADD . .
RUN pip install --upgrade pip && pip install -r requirements.txt && \
pip install git+https://github.com/teampopong/popong-models.git && \
pip install git+https://github.com/teampopong/popong-data-utils.git && \
pip install git+https://github.com/teampopong/popong-nlp.git && \
git submodule init && git submodule update

ADD .conf.samples/alembic.ini.sample /pokr.kr/alembic.ini
ADD .conf.samples/settings.py.sample /pokr.kr/settings.py
#RUN cat /pokr.kr/.conf.samples/alembic.ini.sample | sed 's/ID_HERE/docker/g' | sed 's/PASSWD_HERE/docker/g' | sed 's/HOST_HERE/localhost/g' > ./pokr.kr/alembic.ini

EXPOSE 8000
ENTRYPOINT ./entrypoint.sh
Empty file added conf/nginx.conf
Empty file.
58 changes: 58 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
version: '3'
services:
db:
image: postgres:11.3
restart: always
container_name: pokr-db
ports:
- 5432:5432
environment:
- PGDATA=/data/pgdata
- POSTGRES_DB=${DB_NAME}
- POSTGRES_USER=${DB_USER}
- POSTGRES_PASSWORD=${DB_PASSWORD}

app:
container_name: pokr-app
build: .
volumes:
- /data:/data
- /tmp:/tmp
- /share:/share
- django-static:/django-static
environment:
- DJANGO_STATIC_ROOT=/django-static
depends_on:
- db
restart: always
logging:
driver: "json-file"
options:
max-size: "100k"
max-file: "10"

nginx:
image: nginx:stable
container_name: pokr-nginx
restart: always
volumes:
- django-static:/django-static
- ./conf/nginx.conf:/etc/nginx/conf.d/pokr.conf
ports:
- ${NGINX_SERVING_PORT}:80
command:
- /bin/bash
- -c
- |
rm -f /etc/nginx/conf.d/default.conf
nginx -g 'daemon off;'
depends_on:
- app
logging:
driver: "json-file"
options:
max-size: "100k"
max-file: "10"

volumes:
django-static:
3 changes: 3 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh

/bin/bash