Spaces:
Running
Running
BraydenMoore
commited on
Commit
•
2144817
1
Parent(s):
3231b63
Add docker file
Browse files- Dockerfile.dockerfile +29 -0
Dockerfile.dockerfile
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Use the official lightweight Python image.
|
2 |
+
FROM python:3.11
|
3 |
+
|
4 |
+
# Allow statements and log messages to immediately appear in the logs
|
5 |
+
ENV PYTHONUNBUFFERED True
|
6 |
+
|
7 |
+
# Copy local code to the container image.
|
8 |
+
ENV APP_HOME /app
|
9 |
+
WORKDIR $APP_HOME
|
10 |
+
COPY . ./
|
11 |
+
|
12 |
+
# Install production dependencies.
|
13 |
+
RUN pip install --no-cache-dir -r requirements.txt
|
14 |
+
|
15 |
+
# Create a non-root user and switch to it
|
16 |
+
RUN useradd -m -u 1000 user
|
17 |
+
USER user
|
18 |
+
ENV HOME=/home/user \
|
19 |
+
PATH=/home/user/.local/bin:$PATH
|
20 |
+
|
21 |
+
# Set work directory
|
22 |
+
WORKDIR $APP_HOME
|
23 |
+
|
24 |
+
# Change ownership of app files to the new user
|
25 |
+
COPY --chown=user . $HOME/app
|
26 |
+
|
27 |
+
# Run the web service on container startup.
|
28 |
+
CMD exec gunicorn --bind 0.0.0.0:7860 --workers 9 --threads 16 --timeout 120 main:app
|
29 |
+
|