File size: 851 Bytes
d262af2
 
e7cf806
cecd57a
e7cf806
 
cecd57a
 
 
98dac34
 
0c8234a
f68a38d
0c8234a
 
d262af2
 
 
 
 
0c8234a
 
 
 
 
 
 
f68a38d
 
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
# Use official Python 3.9 image
FROM python:3.9

# Set working directory to /app (root of the repository)
WORKDIR /app

# Copy requirements file
COPY ./requirements.txt /app/requirements.txt

# Install dependencies from requirements.txt only
RUN pip install --no-cache-dir --upgrade -r requirements.txt

# Copy the entire project including schemas and questions
COPY . /app

# Create user, directory, and log file with proper ownership in one step
RUN useradd -m -u 1000 user && \
    mkdir -p /home/user && \
    touch /home/user/app.log && \
    chown user:user /home/user/app.log
USER user
ENV HOME=/home/user \
    PATH=/home/user/.local/bin:$PATH

# Expose port
EXPOSE 7860

# Command to run the app with debug logging
CMD ["sh", "-c", "uvicorn app.main:app --host 0.0.0.0 --port 7860 --log-level debug --log-config log_config.json --access-log"]