File size: 604 Bytes
dc746f2
 
9d4bd7c
dc746f2
 
9d4bd7c
dc746f2
 
9d4bd7c
dc746f2
 
9d4bd7c
 
dc746f2
9d4bd7c
 
dc746f2
 
9d4bd7c
 
dc746f2
9d4bd7c
dc746f2
 
 
 
9d4bd7c
dc746f2
 
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
# Builder stage
FROM python:3.10.0 as builder

# Create a non-root user
RUN useradd -ms /bin/bash admin

# Set the working directory
WORKDIR /srv

# Copy requirements file first to leverage caching
COPY --chown=admin requirements.txt .

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


# Copy the application code
COPY --chown=admin . /srv


# Give read and write permissions to the admin user

RUN chown -R admin:admin /srv
RUN chmod 755 /srv
USER admin
CMD python -m uvicorn main:app --workers 1 --host 0.0.0.0 --port 7860  --log-level debug

# Expose port
EXPOSE 7860