1
0
mirror of https://gitlab.crans.org/mediatek/med.git synced 2024-11-27 01:27:10 +00:00

Merge branch 'docker' into 'master'

Docker

See merge request mediatek/med!1
This commit is contained in:
erdnaxe 2020-02-09 13:37:34 +01:00
commit 12f165773c
5 changed files with 57 additions and 10 deletions

18
Dockerfile Normal file
View File

@ -0,0 +1,18 @@
FROM python:3-buster
ENV PYTHONUNBUFFERED 1
RUN mkdir /code
WORKDIR /code
RUN apt update && \
apt install -y gettext nginx uwsgi uwsgi-plugin-python3 && \
rm -rf /var/lib/apt/lists/*
COPY requirements.txt /code/
RUN pip install -r requirements.txt
COPY . /code/
ENTRYPOINT ["/code/entrypoint.sh"]
EXPOSE 8000

View File

@ -29,12 +29,20 @@ ainsi qu'un user med et un mot de passe associé.
Voici les étapes à éxecuter pour mysql : Voici les étapes à éxecuter pour mysql :
```SQL ```SQL
CREATE DATABASE club-med; CREATE DATABASE med;
CREATE USER 'club-med'@'localhost' IDENTIFIED BY 'password'; CREATE USER 'med'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON club-med.* TO 'club-med'@'localhost'; GRANT ALL PRIVILEGES ON med.* TO 'med'@'localhost';
FLUSH PRIVILEGES; FLUSH PRIVILEGES;
``` ```
Et pour postgresql :
```SQL
CREATE DATABASE med;
CREATE USER med WITH PASSWORD 'password';
GRANT ALL PRIVILEGES ON DATABASE med TO med;
```
## Exemple de groupes de droits ## Exemple de groupes de droits
``` ```

8
entrypoint.sh Executable file
View File

@ -0,0 +1,8 @@
#!/bin/bash
python manage.py compilemessages
python manage.py makemigrations
sleep 2
python manage.py migrate
# TODO: use uwsgi in production
python manage.py runserver 0.0.0.0:8000

View File

@ -32,10 +32,22 @@ DEBUG = True
DATABASES = { DATABASES = {
'default': { 'default': {
'ENGINE': 'django.db.backends.mysql', 'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'club-med', 'NAME': 'med',
'USER': 'club-med', 'USER': 'med',
'PASSWORD': 'CHANGE ME !!!', 'PASSWORD': 'password_to_store_in_env',
'HOST': 'localhost', 'HOST': 'db',
}, 'PORT': '',
}
} }
# or MySQL database for Zamok
# DATABASES = {
# 'default': {
# 'ENGINE': 'django.db.backends.mysql',
# 'NAME': 'club-med',
# 'USER': 'club-med',
# 'PASSWORD': 'CHANGE ME !!!',
# 'HOST': 'localhost',
# },
# }

View File

@ -9,3 +9,4 @@ python-stdnum==1.10
djangorestframework==3.9.2 djangorestframework==3.9.2
pyyaml==3.13 pyyaml==3.13
coreapi==2.3.3 coreapi==2.3.3
psycopg2