File size: 1,356 Bytes
66bae18
 
d2e8024
66bae18
d2e8024
66bae18
 
d2e8024
66bae18
 
d2e8024
 
66bae18
 
d2e8024
 
66bae18
d2e8024
c50f4cd
d2e8024
66bae18
c50f4cd
66bae18
c50f4cd
 
d2e8024
66bae18
c50f4cd
d2e8024
66bae18
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
c50f4cd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# Use a base image with espeak pre-installed (adjust based on your needs)
FROM ubuntu:22.04

# Create a user for the application
RUN useradd -m -u 1000 user

# Switch to the user
USER user

# Set environment variables
ENV HOME=/home/user \
    PATH=/home/user/.local/bin:$PATH

# Set working directory
WORKDIR $HOME/app

# Copy application files and requirements
COPY --chown=user . $HOME/app
COPY ./requirements.txt $HOME/app/requirements.txt

# Install espeak-ng (assuming it's used in your application)
RUN apt-get update && \
    apt-get install espeak-ng && \
    apt-get clean && \
    rm -rf /var/lib/apt/lists/*

# Install other Python dependencies from requirements.txt
RUN pip install --no-cache-dir -r requirements.txt

# Handle architecture mismatch for Apple Silicon (optional)
# If using Apple Silicon with Ventura and above, uncomment the following block
# and adjust the paths based on your system

# USER root
# RUN apt-get update && \
#     apt-get install software-properties-common && \
#     add-apt-repository ppa:deadsnakes/ppa && \
#     apt-get update && \
#     apt-get install python3.11-arm64 && \
#     apt-get clean && \
#     rm -rf /var/lib/apt/lists/*
#
# USER user
# ENV PYTHONIOENCODING=utf-8
# ENV PATH=/usr/lib/python3.11/bin:$PATH

# Start the application (assuming app.py is the entry point)
CMD ["python", "app.py"]