From 9014081bff375f4a2432be676b1b18dce514d3ee Mon Sep 17 00:00:00 2001 From: Tony Hendrick Date: Tue, 12 May 2020 21:38:25 -0700 Subject: [PATCH] Adding docker directory with docker support --- config.json | 2 +- docker/.env | 6 ++++++ docker/Dockerfile | 18 ++++++++++++++++++ docker/docker-compose.yml | 21 +++++++++++++++++++++ requirements.txt | 1 + 5 files changed, 47 insertions(+), 1 deletion(-) create mode 100644 docker/.env create mode 100644 docker/Dockerfile create mode 100644 docker/docker-compose.yml diff --git a/config.json b/config.json index be6ecb6..5053faa 100755 --- a/config.json +++ b/config.json @@ -1 +1 @@ -{"TITLE": "pyShelf E-Book Server", "VERSION": "0.5.0", "BOOKPATH": "", "DB_HOST": "db", "DB_PORT": "5432", "DATABASE": "pyshelf", "USER": "pyshelf", "PASSWORD": "mysecretpassword", "BOOKSHELF": "data/shelf.json", "ALLOWED_HOSTS": "*", "hostname": "localhost", "webport": "8000", "wsgiport": "8001"} +{"TITLE": "pyShelf E-Book Server", "VERSION": "0.5.0", "BOOKPATH": "", "DB_HOST": "db", "DB_PORT": "5432", "DATABASE": "pyshelf", "USER": "pyshelf", "PASSWORD": "pyshelf", "BOOKSHELF": "data/shelf.json", "ALLOWED_HOSTS": "*", "hostname": "localhost", "webport": "8000", "wsgiport": "8001"} diff --git a/docker/.env b/docker/.env new file mode 100644 index 0000000..c86c711 --- /dev/null +++ b/docker/.env @@ -0,0 +1,6 @@ +LOCAL_BOOK_DIR=/home/marvin/git/hatpyShelf/docker/Books/ +PORT=8088 +POSTGRES_VER=12.2 +POSTGRES_USER=pyshelf +POSTGRES_PASSWORD=pyshelf +POSTGRES_DB=pyshelf diff --git a/docker/Dockerfile b/docker/Dockerfile new file mode 100644 index 0000000..8ea134c --- /dev/null +++ b/docker/Dockerfile @@ -0,0 +1,18 @@ +# docker build -t ubuntu1604py36 +FROM ubuntu:18.04 + +RUN apt-get update && apt-get install -y software-properties-common +RUN add-apt-repository ppa:deadsnakes/ppa +RUN apt-get update -y + +RUN apt-get install -y build-essential python3.8 python3.8-dev python3-pip python3.8-venv && apt-get install -y git + +# update pip +RUN python3 -m pip install wheel +RUN git clone https://github.com/hat/pyShelf.git /usr/src/app/ +RUN python3 -m pip install -r /usr/src/app/requirements.txt +#CMD [""] +#RUN python3 manage.py migrate +#RUN python3 manage.py migrate interface +WORKDIR /usr/src/app/src/ +CMD ["python3", "manage.py", "runserver"] diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml new file mode 100644 index 0000000..3d29bc2 --- /dev/null +++ b/docker/docker-compose.yml @@ -0,0 +1,21 @@ +version: "3.3" +services: + db: + image: "postgres:${POSTGRES_VER}" + environment: + - "POSTGRES_PASSWORD=${POSTGRES_PASSWORD}" + - "POSTGRES_USER=${POSTGRES_USER}" + - "POSTGRES_DB=${POSTGRES_DB}" + + pyshelf: + build: + context: ./ + dockerfile: Dockerfile + volumes: + - "${LOCAL_BOOK_DIR}:/Books" + ports: + - "8088:8000" + links: + - "db:db" + depends_on: + - db diff --git a/requirements.txt b/requirements.txt index 749a3dd..5557e73 100755 --- a/requirements.txt +++ b/requirements.txt @@ -17,3 +17,4 @@ psycopg2-binary prompt_toolkit psutil pyfiglet +pudb