File size: 919 Bytes
30c5114
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
# Use the Ubuntu image.
FROM python:3.11-slim-buster

# Allow statements and log messages to immediately appear in the logs
ENV PYTHONUNBUFFERED True

# Copy local code to the container image.
WORKDIR /code
COPY . /code/

# Delete the numpy package from cache
RUN rm -rf /root/.cache/pip

# Install system dependencies for pyworld
RUN apt-get update && \
    apt-get install -y && \
    apt-get -y update &&\
    apt-get install -y python3-pip python3-dev python3-opencv && \
    rm -rf /var/lib/apt/lists/*

# Add write user 
RUN useradd -m -u 1000 user
USER user
ENV HOME=/home/user \
	PATH=/home/user/.local/bin:$PATH

WORKDIR $HOME/app

COPY --chown=user . $HOME/app

# Install production dependencies.
RUN pip install --no-cache-dir -r /code/requirements.txt

# Expose the app port
EXPOSE 7860

# Run the FastAPI application using Uvicorn server.
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]