File size: 1,929 Bytes
97bdbd7
3e5810f
97bdbd7
 
fcb53b1
97bdbd7
 
fcb53b1
97bdbd7
dde54de
fab96df
97bdbd7
fcb53b1
 
 
 
d1ee108
207cc95
 
8d13d76
c6e77a7
fab96df
722a6cd
 
 
 
 
1ad58b2
a152566
 
31da180
1ad58b2
2edf42c
038dd89
 
97bdbd7
fcb53b1
 
 
0d358c3
97bdbd7
56933d4
97bdbd7
 
a152566
97bdbd7
513d794
a152566
 
18d0731
fc35250
 
97bdbd7
fcb53b1
52a427c
97bdbd7
e5ce3a5
25337ed
 
 
7846fc9
97bdbd7
a128d0a
aeb8dbd
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# Define the image argument and provide a default value
ARG IMAGE=python:3.10-slim-bullseye

# Use the image as specified
FROM ${IMAGE}

# Re-declare the ARG after FROM
ARG IMAGE


#RUN curl -fsSL https://www.postgresql.org/media/keys/ACCC4CF8.asc | gpg --dearmor -o /etc/apt/trusted.gpg.d/postgresql.gpg
# Update and upgrade the existing packages 
RUN apt-get update && apt-get upgrade -y && apt-get install -y --no-install-recommends \
   python3 \
    python3-pip \
    ninja-build \
    build-essential \
    pkg-config \
    gnupg2 \
    wget

#RUN apt-get update && apt-get install postgresql-16 postgresql-contrib-16 -y

WORKDIR /app

COPY . .

# Set up a new user named "user" with user ID 1000
RUN useradd -u 1000 user

RUN chown -R user:user .

#RUN useradd -ms /bin/bash user
#RUN addgroup -g 1001 -S 1000 
#RUN adduser -u 1001 -S 1000 -G 1000
# Set environment variable for the host
ENV HOST=0.0.0.0
ENV PORT=7860
ENV ORIGINS=*
ENV TF_ENABLE_ONEDNN_OPTS=0


 
# Switch to the "user" user
USER user
# Set home to the user's home directory

ENV HOME=/home/user \
    PATH=/home/user/.local/bin:$PATH/app

#RUN export MYSQLCLIENT_CFLAGS=`pkg-config mysqlclient --cflags`
#RUN export MYSQLCLIENT_LDFLAGS=`pkg-config mysqlclient --libs`
# Set the working directory to the user's home directory
#WORKDIR $HOME/app
#RUN chmod -R 755 $HOME/app
# Copy the current directory contents into the container at $HOME/app setting the owner to the user
#COPY --chown=user . $HOME/app
RUN python3 -m pip install --upgrade pip
# Install requirements.txt 
RUN pip install --no-cache-dir --upgrade -r requirements.txt
CMD ["python", "-m", "main"]
# Start the FastAPI app on port 7860, the default port expected by Spaces
#CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
#ENTRYPOINT ["python3", "-m", "llama_cpp.server", "--hf_model_repo_id", "Qwen/Qwen1.5-0.5B-Chat-GGUF", "--model", "*q4_0.gguf", "--host", "0.0.0.0"]