Add dockerfile and docker-compose (testing purposes)
This commit is contained in:
parent
5722358f21
commit
1ae85bab61
|
@ -3,3 +3,5 @@ venv
|
|||
__pycache__
|
||||
db.sqlite3
|
||||
*_local.py
|
||||
custom.css
|
||||
custom.css.map
|
|
@ -0,0 +1,15 @@
|
|||
FROM python:3.7-buster
|
||||
|
||||
WORKDIR /usr/src/app
|
||||
COPY doc/requirements.txt .
|
||||
RUN pip install -r requirements.txt
|
||||
|
||||
COPY onebet/mainapp mainapp
|
||||
COPY onebet/onebet onebet
|
||||
COPY onebet/scripts scripts
|
||||
COPY onebet/manage.py manage.py
|
||||
RUN rm -f onebet/settings_local.py
|
||||
EXPOSE 8000
|
||||
|
||||
RUN chown -R www-data .
|
||||
USER www-data
|
|
@ -0,0 +1,49 @@
|
|||
# This is a docker-compose made only for testing purpose
|
||||
#
|
||||
# If any change has been done :
|
||||
# > docker-compose -p onebet up --build -d
|
||||
|
||||
# Else :
|
||||
# > docker-compose -p onebet up -d
|
||||
|
||||
version: "3.7"
|
||||
|
||||
services:
|
||||
app:
|
||||
build: .
|
||||
image: onebet
|
||||
environment:
|
||||
DJANGO_SECRET: test
|
||||
DJANGO_DEBUG: 1
|
||||
POSTGRES_DATABASE: onebet
|
||||
POSTGRES_USERNAME: onebet
|
||||
POSTGRES_PASSWORD: onebet
|
||||
POSTGRES_HOST: db
|
||||
POSTGRES_PORT: 5432
|
||||
depends_on:
|
||||
- db
|
||||
ports:
|
||||
- 127.0.0.1:8000:8000
|
||||
command:
|
||||
- /bin/sh
|
||||
- -c
|
||||
- |
|
||||
echo "waiting postgres database..."
|
||||
sleep 5
|
||||
echo "setting postgres schema..."
|
||||
python manage.py migrate
|
||||
echo "initialising postgres with default keys"
|
||||
python manage.py initdb
|
||||
echo "compling scss files..."
|
||||
python manage.py compilescss
|
||||
echo "running django server..."
|
||||
python manage.py runserver 0.0.0.0:8000
|
||||
|
||||
db:
|
||||
image: postgres:11.7-alpine
|
||||
environment:
|
||||
POSTGRES_USER: onebet
|
||||
POSTGRES_PASSWORD: onebet
|
||||
POSTGRES_DB: onebet
|
||||
ports:
|
||||
- 127.0.0.1:5432:5432
|
Loading…
Reference in New Issue