diff --git a/.gitignore b/.gitignore index 1905000..58d499f 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,5 @@ venv __pycache__ db.sqlite3 *_local.py +custom.css +custom.css.map \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..7d5f2d7 --- /dev/null +++ b/Dockerfile @@ -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 diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..3fe2e08 --- /dev/null +++ b/docker-compose.yml @@ -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