File size: 823 Bytes
cf0188d
 
6e98792
cf0188d
0586738
6e98792
cf0188d
 
 
 
 
0586738
dabdd0b
cf0188d
 
 
 
 
 
 
 
 
f18e248
cf0188d
 
 
6e98792
cf0188d
 
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
# 1. Use an official lightweight Python runtime as a parent image
FROM python:3.11-slim

# 2. Set the working directory inside the container
WORKDIR /app

# 3. Copy the requirements file into the container at /app
COPY requirements.txt .

# 4. Install any needed packages specified in requirements.txt
# --no-cache-dir keeps the image small
RUN pip install --no-cache-dir -r requirements.txt

# 5. Copy the rest of the application code
COPY . .

# 6. Create a non-root user (Required for Hugging Face Spaces)
# This creates a user named "user" with ID 1000
RUN useradd -m -u 1000 user

# 7. Switch to the new user
USER user

# 8. Set environment variables to ensure the user's home path works
ENV HOME=/home/user \
    PATH=/home/user/.local/bin:$PATH

# 9. Run the bot when the container launches
CMD ["python", "bot.py"]