From a3b4984731058edfd1bf352f7d89ce4689a5963c Mon Sep 17 00:00:00 2001
From: gabriellisboaconegero <gabriellisboaconegero@gmail.com>
Date: Fri, 10 May 2024 11:54:24 -0300
Subject: [PATCH] chore: Criando dockerfile

---
 Dockerfile  | 13 +++++++++++++
 settings.py |  8 +++++---
 2 files changed, 18 insertions(+), 3 deletions(-)
 create mode 100644 Dockerfile

diff --git a/Dockerfile b/Dockerfile
new file mode 100644
index 0000000..2120f16
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,13 @@
+FROM monetdb/monetdb:latest
+
+# Nome do banco para criar
+ENV MDB_CREATE_DBS=treinamento
+
+# Senha do user monetdb
+ENV MDB_DB_ADMIN_PASS=12345
+
+RUN mkdir open_data
+
+COPY ./open_data/ ./open_data
+
+EXPOSE 50000
diff --git a/settings.py b/settings.py
index 75a4f5b..bb1888c 100644
--- a/settings.py
+++ b/settings.py
@@ -22,7 +22,7 @@ along with HOTMapper.  If not, see <https://www.gnu.org/licenses/>.
 import logging
 
 def db_env_file_path(file_name):
-    return file_name.replace('glc22', 'monetdb')
+    return "/open_data/"+file_name.split('/')[-1]
 
 # SQL dialect used by sqlalchemy.
 DATABASE_DIALECT = 'monetdb'
@@ -34,6 +34,7 @@ DATABASE_USER_PASSWORD = '12345'
 # Host to connect to. Bulk inserts won't work remotely unless you can specify an
 # absolute path in the server
 DATABASE_HOST = 'localhost'
+DATABASE_PORT = '50001'
 
 # Database to connect to
 DATABASE = 'treinamento'
@@ -42,8 +43,9 @@ DATABASE = 'treinamento'
 YEAR_COLUMN = 'ano_censo'
 
 # URI structure. Standards to login:password model, but can be changed as needed.
-DATABASE_URI = '{}://{}:{}@{}/{}'.format(DATABASE_DIALECT, DATABASE_USER,
-                                         DATABASE_USER_PASSWORD, DATABASE_HOST, DATABASE)
+DATABASE_URI = '{}://{}:{}@{}:{}/{}'.format(DATABASE_DIALECT, DATABASE_USER,
+                                         DATABASE_USER_PASSWORD, DATABASE_HOST,
+                                         DATABASE_PORT, DATABASE)
 # Folder and file where backup is created - absolute path
 BACKUP_FOLDER = '/home/banco/dumps/monetdb/'
 BACKUP_FILE = 'backupdadoseducacionais'
-- 
GitLab