gavinzli commited on
Commit
309c5cc
·
1 Parent(s): 0ca6462

Refactor Dockerfile to install SQLite directly via package manager; update mail controller to retrieve user ID correctly

Browse files
Files changed (2) hide show
  1. Dockerfile +7 -16
  2. app/controllers/mail.py +1 -2
Dockerfile CHANGED
@@ -1,22 +1,13 @@
1
  # Use the official Python 3.10.9 image
2
  FROM python:3.10.9
3
 
4
- # Install dependencies for building SQLite
5
- RUN apt-get update && apt-get install -y \
6
- build-essential \
7
- wget \
8
- libsqlite3-dev \
9
- && rm -rf /var/lib/apt/lists/*
10
-
11
- # Install SQLite 3.35.0 or higher from source
12
- RUN wget https://www.sqlite.org/2025/sqlite-autoconf-3410000.tar.gz && \
13
- tar -xzf sqlite-autoconf-3410000.tar.gz && \
14
- cd sqlite-autoconf-3410000 && \
15
- ./configure && \
16
- make && \
17
- make install && \
18
- cd .. && \
19
- rm -rf sqlite-autoconf-3410000 sqlite-autoconf-3410000.tar.gz
20
 
21
  # Verify SQLite version
22
  RUN sqlite3 --version
 
1
  # Use the official Python 3.10.9 image
2
  FROM python:3.10.9
3
 
4
+ RUN apt-get update && \
5
+ apt-get install -y sqlite3 libsqlite3-dev && \
6
+ apt-get clean && \
7
+ rm -rf /var/lib/apt/lists/*
8
+
9
+ # Verify SQLite3 installation
10
+ RUN sqlite3 --version
 
 
 
 
 
 
 
 
 
11
 
12
  # Verify SQLite version
13
  RUN sqlite3 --version
app/controllers/mail.py CHANGED
@@ -78,7 +78,6 @@ def list_emails(messages):
78
  ids = []
79
  documents = []
80
  for message in messages:
81
- user_id = service.users().getProfile(userId="me").execute().get("emailAddress")
82
  msg = service.users().messages().get(userId="me", id=message["id"], format="full").execute()
83
  metadata = {}
84
  for header in msg["payload"]["headers"]:
@@ -93,7 +92,7 @@ def list_emails(messages):
93
  metadata["date"] = datetime.fromtimestamp(int(msg["internalDate"]) / 1000).strftime(
94
  "%d/%m/%Y %H:%M:%S"
95
  )
96
- metadata["user_id"] = user_id
97
  metadata["msg_id"] = msg["id"]
98
  print(metadata, msg["payload"]["mimeType"])
99
  ids = []
 
78
  ids = []
79
  documents = []
80
  for message in messages:
 
81
  msg = service.users().messages().get(userId="me", id=message["id"], format="full").execute()
82
  metadata = {}
83
  for header in msg["payload"]["headers"]:
 
92
  metadata["date"] = datetime.fromtimestamp(int(msg["internalDate"]) / 1000).strftime(
93
  "%d/%m/%Y %H:%M:%S"
94
  )
95
+ metadata["user_id"] = service.users().getProfile(userId="me").execute().get("emailAddress")
96
  metadata["msg_id"] = msg["id"]
97
  print(metadata, msg["payload"]["mimeType"])
98
  ids = []