praneeth300 commited on
Commit
d45084b
·
verified ·
1 Parent(s): 8437471

Create Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +43 -0
Dockerfile ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ # Use an official Python runtime as a parent image
3
+ FROM python:3.10-slim
4
+
5
+
6
+ # Set environment variables
7
+ ENV PYTHONUNBUFFERED 1
8
+
9
+
10
+ # Install system dependencies and git
11
+ RUN apt-get update && apt-get install -y \
12
+ build-essential \
13
+ git \
14
+ && rm -rf /var/lib/apt/lists/*
15
+
16
+
17
+
18
+
19
+ # Create a non-root user and set permissions
20
+ RUN useradd -ms /bin/bash appuser
21
+ # Set the working directory in the container
22
+ WORKDIR /home/appuser/app
23
+
24
+
25
+ # Copy the requirements file and install dependencies
26
+ COPY requirements.txt .
27
+ RUN pip install --upgrade pip && pip install -r requirements.txt
28
+
29
+
30
+ # Switch to non-root user
31
+ USER appuser
32
+
33
+
34
+ # Copy the rest of the application code into the container
35
+ COPY --chown=appuser . /home/appuser/app
36
+
37
+
38
+ # Expose the port that the app runs on
39
+ EXPOSE 8501
40
+
41
+
42
+ # Command to run the application
43
+ CMD ["streamlit", "run", "app.py", "--server.port=8501", "--server.address=0.0.0.0"]