Skip to content

Commit db56bf9

Browse files
committed
Added docker-compose
1 parent 05daa7c commit db56bf9

File tree

6 files changed

+110
-1
lines changed

6 files changed

+110
-1
lines changed

.dockerignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
venv/

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,3 +128,4 @@ dmypy.json
128128
# Pyre type checker
129129
.pyre/
130130
.idea
131+
.env.*

app.Dockerfile

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
FROM python:3.9.0-buster
2+
WORKDIR /www
3+
ADD requirements.txt .
4+
RUN pip install -r requirements.txt
5+
ADD . .
6+
ENV PYTHONDONTWRITEBYTECODE 1
7+
EXPOSE 5000
8+
ADD .env .
9+
RUN export $(cat .env | xargs)
10+
RUN pip install gunicorn
11+
RUN apt-get update && \
12+
apt-get install -y locales && \
13+
sed -i -e 's/# fr_FR.UTF-8 UTF-8/fr_FR.UTF-8 UTF-8/' /etc/locale.gen && \
14+
dpkg-reconfigure --frontend=noninteractive locales
15+
16+
ENV LANG fr_FR.UTF-8
17+
ENV LC_ALL fr_FR.UTF-8
18+
CMD exec gunicorn --chdir /www --bind :5000 --workers 1 --threads 1 modobot:application --log-level INFO

bot.Dockerfile

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
FROM python:3.9.0-buster
2+
WORKDIR /www
3+
ADD requirements.txt .
4+
RUN pip install -r requirements.txt
5+
ADD . .
6+
ENV PYTHONDONTWRITEBYTECODE 1
7+
EXPOSE 5000
8+
ADD .env .
9+
RUN export $(cat .env | xargs)
10+
RUN apt-get update && \
11+
apt-get install -y locales && \
12+
sed -i -e 's/# fr_FR.UTF-8 UTF-8/fr_FR.UTF-8 UTF-8/' /etc/locale.gen && \
13+
dpkg-reconfigure --frontend=noninteractive locales
14+
15+
ENV LANG fr_FR.UTF-8
16+
ENV LC_ALL fr_FR.UTF-8
17+
CMD python3 bot.py

docker-compose.yml

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
version: '3.3'
2+
3+
services:
4+
mysql:
5+
container_name: mysql
6+
image: mysql
7+
restart: always
8+
environment:
9+
MYSQL_USER: 'modobot'
10+
MYSQL_PASSWORD: 'modobot'
11+
MYSQL_ROOT_PASSWORD: selujroot
12+
MYSQL_DATABASE: modobot
13+
env_file:
14+
- .env.docker
15+
volumes:
16+
- mysql:/var/lib/mysql
17+
networks:
18+
- mysql-net
19+
healthcheck:
20+
test: "/usr/bin/mysql --user=$DB_USER --password=$DB_PASSWORD --execute \"SHOW DATABASES;\""
21+
interval: 3s
22+
timeout: 1s
23+
retries: 5
24+
25+
app:
26+
container_name: app
27+
restart: always
28+
build:
29+
context: .
30+
dockerfile: app.Dockerfile
31+
env_file:
32+
- .env.docker
33+
ports:
34+
- "8080:5000"
35+
volumes:
36+
- app:/app
37+
depends_on:
38+
- mysql
39+
links:
40+
- mysql
41+
networks:
42+
- mysql-net
43+
- app-net
44+
45+
bot:
46+
container_name: bot
47+
restart: always
48+
build:
49+
context: .
50+
dockerfile: bot.Dockerfile
51+
env_file:
52+
- .env.docker
53+
depends_on:
54+
- mysql
55+
- app
56+
links:
57+
- mysql
58+
- app
59+
networks:
60+
- mysql-net
61+
- app-net
62+
- bot-net
63+
64+
networks:
65+
mysql-net:
66+
app-net:
67+
bot-net:
68+
69+
volumes:
70+
mysql:
71+
app:

modobot/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@
2121
from modobot.utils.france_datetime import datetime_now_france
2222
from modobot.utils.logging import setup_logging
2323

24-
locale.setlocale(locale.LC_TIME, "fr_FR")
24+
locale.setlocale(locale.LC_ALL, "fr_FR.UTF-8")
25+
locale.setlocale(locale.LC_TIME, "fr_FR.UTF-8")
2526

2627
ROOT = os.path.join(os.path.dirname(__file__), "..") # refers to application_top
2728
dotenv_path = os.path.join(ROOT, ".env")

0 commit comments

Comments
 (0)