Spaces:
Running
Running
Update Dockerfile
Browse files- Dockerfile +31 -4
Dockerfile
CHANGED
@@ -1,21 +1,48 @@
|
|
1 |
-
|
|
|
2 |
|
|
|
3 |
RUN useradd -m -u 1000 user
|
|
|
|
|
4 |
USER user
|
|
|
|
|
5 |
ENV HOME=/home/user \
|
6 |
PATH=/home/user/.local/bin:$PATH
|
|
|
|
|
7 |
WORKDIR $HOME/app
|
8 |
|
|
|
9 |
COPY --chown=user . $HOME/app
|
10 |
COPY ./requirements.txt $HOME/app/requirements.txt
|
11 |
|
12 |
-
|
13 |
RUN apt-get update && \
|
14 |
-
apt-get install espeak && \
|
15 |
apt-get clean && \
|
16 |
rm -rf /var/lib/apt/lists/*
|
17 |
|
18 |
-
|
19 |
RUN pip install --no-cache-dir -r requirements.txt
|
20 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
CMD ["python", "app.py"]
|
|
|
1 |
+
# Use a base image with espeak pre-installed (adjust based on your needs)
|
2 |
+
FROM ubuntu:22.04
|
3 |
|
4 |
+
# Create a user for the application
|
5 |
RUN useradd -m -u 1000 user
|
6 |
+
|
7 |
+
# Switch to the user
|
8 |
USER user
|
9 |
+
|
10 |
+
# Set environment variables
|
11 |
ENV HOME=/home/user \
|
12 |
PATH=/home/user/.local/bin:$PATH
|
13 |
+
|
14 |
+
# Set working directory
|
15 |
WORKDIR $HOME/app
|
16 |
|
17 |
+
# Copy application files and requirements
|
18 |
COPY --chown=user . $HOME/app
|
19 |
COPY ./requirements.txt $HOME/app/requirements.txt
|
20 |
|
21 |
+
# Install espeak-ng (assuming it's used in your application)
|
22 |
RUN apt-get update && \
|
23 |
+
apt-get install espeak-ng && \
|
24 |
apt-get clean && \
|
25 |
rm -rf /var/lib/apt/lists/*
|
26 |
|
27 |
+
# Install other Python dependencies from requirements.txt
|
28 |
RUN pip install --no-cache-dir -r requirements.txt
|
29 |
|
30 |
+
# Handle architecture mismatch for Apple Silicon (optional)
|
31 |
+
# If using Apple Silicon with Ventura and above, uncomment the following block
|
32 |
+
# and adjust the paths based on your system
|
33 |
+
|
34 |
+
# USER root
|
35 |
+
# RUN apt-get update && \
|
36 |
+
# apt-get install software-properties-common && \
|
37 |
+
# add-apt-repository ppa:deadsnakes/ppa && \
|
38 |
+
# apt-get update && \
|
39 |
+
# apt-get install python3.11-arm64 && \
|
40 |
+
# apt-get clean && \
|
41 |
+
# rm -rf /var/lib/apt/lists/*
|
42 |
+
#
|
43 |
+
# USER user
|
44 |
+
# ENV PYTHONIOENCODING=utf-8
|
45 |
+
# ENV PATH=/usr/lib/python3.11/bin:$PATH
|
46 |
+
|
47 |
+
# Start the application (assuming app.py is the entry point)
|
48 |
CMD ["python", "app.py"]
|