Richard commited on
Commit
4d2a056
·
1 Parent(s): 23ee834

Add docker image + bug fixes

Browse files
Files changed (4) hide show
  1. Dockerfile +34 -0
  2. app.py +1 -1
  3. docker-compose.yml +7 -0
  4. requirements.txt +2 -1
Dockerfile ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Build Docker image for deployment.
2
+
3
+ FROM python:3.10.14-bullseye
4
+
5
+ RUN apt-get update && \
6
+ apt-get install -y \
7
+ # General dependencies
8
+ locales \
9
+ locales-all && \
10
+ # Clean local repository of package files since they won't be needed anymore.
11
+ # Make sure this line is called after all apt-get update/install commands have
12
+ # run.
13
+ apt-get clean && \
14
+ # Also delete the index files which we also don't need anymore.
15
+ rm -rf /var/lib/apt/lists/*
16
+
17
+ ENV LC_ALL en_US.UTF-8
18
+ ENV LANG en_US.UTF-8
19
+ ENV LANGUAGE en_US.UTF-8
20
+
21
+ # Install dependencies
22
+ COPY requirements.txt .
23
+ RUN pip install -r requirements.txt
24
+
25
+ # Create non-root user
26
+ RUN groupadd -g 900 mesop && useradd -u 900 -s /bin/bash -g mesop mesop
27
+ USER mesop
28
+
29
+ # Add app code here
30
+ COPY . /srv/mesop-jeopardy
31
+ WORKDIR /srv/mesop-jeopardy
32
+
33
+ # Run Mesop through gunicorn. Should be available at localhost:8080
34
+ CMD ["gunicorn", "--bind", "0.0.0.0:8080", "app:me"]
app.py CHANGED
@@ -67,7 +67,7 @@ def app():
67
  elif key == state.selected_question_key:
68
  me.text(cell["question"], style=me.Style(text_align="left"))
69
  else:
70
- me.text(f"${cell["normalized_value"]}", style=me.Style(font_size="2.2vw"))
71
 
72
  # Sidebar
73
  with me.box(style=css.SIDEBAR):
 
67
  elif key == state.selected_question_key:
68
  me.text(cell["question"], style=me.Style(text_align="left"))
69
  else:
70
+ me.text(f"${cell['normalized_value']}", style=me.Style(font_size="2.2vw"))
71
 
72
  # Sidebar
73
  with me.box(style=css.SIDEBAR):
docker-compose.yml ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ services:
2
+ mesop:
3
+ build: .
4
+ ports:
5
+ - "8080:8080"
6
+ environment:
7
+ - GOOGLE_API_KEY=YOUR-API-KEY-HERE
requirements.txt CHANGED
@@ -1,2 +1,3 @@
1
- mesop==0.5.6
2
  google-generativeai
 
 
1
+ mesop==0.9.1
2
  google-generativeai
3
+ gunicorn==22.0.0