James Wade commited on
Commit
1c83a92
·
1 Parent(s): 57fec47

add user for container

Browse files
Files changed (2) hide show
  1. Dockerfile +9 -0
  2. app.py +0 -1
Dockerfile CHANGED
@@ -1,5 +1,8 @@
1
  FROM python:3.10
2
 
 
 
 
3
  WORKDIR /code
4
 
5
  COPY ./requirements.txt /code/requirements.txt
@@ -8,6 +11,12 @@ RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
8
 
9
  COPY . .
10
 
 
 
 
 
 
 
11
  EXPOSE 7860
12
 
13
  CMD ["shiny", "run", "app.py", "--host", "0.0.0.0", "--port", "7860"]
 
1
  FROM python:3.10
2
 
3
+ # Create a non-root user to run the application
4
+ RUN adduser --disabled-password --gecos "" appuser
5
+
6
  WORKDIR /code
7
 
8
  COPY ./requirements.txt /code/requirements.txt
 
11
 
12
  COPY . .
13
 
14
+ # Change the ownership of the /code directory to appuser
15
+ RUN chown -R appuser:appuser /code
16
+
17
+ # Switch to the appuser user
18
+ USER appuser
19
+
20
  EXPOSE 7860
21
 
22
  CMD ["shiny", "run", "app.py", "--host", "0.0.0.0", "--port", "7860"]
app.py CHANGED
@@ -2,7 +2,6 @@ from shiny import ui, reactive, render, App
2
  from chemcrow.agents import ChemCrow
3
  import asyncio
4
  import shinyswatch
5
- import html
6
 
7
  chem_model = ChemCrow(model="gpt-4-0613", temp=0.1, verbose=True)
8
 
 
2
  from chemcrow.agents import ChemCrow
3
  import asyncio
4
  import shinyswatch
 
5
 
6
  chem_model = ChemCrow(model="gpt-4-0613", temp=0.1, verbose=True)
7