Spaces:
Runtime error
Runtime error
HeshamHaroon
commited on
Commit
•
e0681b7
1
Parent(s):
0a9a631
Create Dockerfile
Browse files- Dockerfile +28 -0
Dockerfile
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Use an official Python runtime as a parent image
|
2 |
+
FROM python:3.10-slim
|
3 |
+
|
4 |
+
# Create a new user named "user" with user ID 1000
|
5 |
+
RUN useradd -m -u 1000 user
|
6 |
+
|
7 |
+
# Switch to the "user" user
|
8 |
+
USER user
|
9 |
+
|
10 |
+
# Set home to the user's home directory
|
11 |
+
ENV HOME=/home/user \
|
12 |
+
PATH=/home/user/.local/bin:$PATH
|
13 |
+
|
14 |
+
# Set the working directory to the user's home directory
|
15 |
+
WORKDIR $HOME/app
|
16 |
+
|
17 |
+
# Copy the current directory contents into the container at $HOME/app
|
18 |
+
COPY --chown=user . $HOME/app
|
19 |
+
|
20 |
+
# Install dependencies
|
21 |
+
RUN pip install --no-cache-dir -r requirements.txt
|
22 |
+
|
23 |
+
# Expose the secret at buildtime
|
24 |
+
RUN --mount=type=secret,id=HF_TOKEN,mode=0444 \
|
25 |
+
echo "Hugging Face token retrieved"
|
26 |
+
|
27 |
+
# Start the app
|
28 |
+
CMD ["python", "app.py"]
|