File size: 1,249 Bytes
729d130
13f8e7d
 
729d130
804ddc3
13f8e7d
8e14974
 
13f8e7d
 
 
 
729d130
 
 
13f8e7d
729d130
 
804ddc3
729d130
 
13f8e7d
dc082d6
13f8e7d
 
 
 
 
729d130
 
13f8e7d
 
 
729d130
13f8e7d
804ddc3
729d130
dc082d6
 
13f8e7d
804ddc3
5ea5121
dc082d6
 
729d130
 
6862a1e
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
# Use an official Python runtime as a parent image
FROM nvidia/cuda:12.3.1-runtime-ubuntu22.04

# Set Python to use unbuffered mode
ENV PYTHONUNBUFFERED=1

ENV PATH="/var/www/.local/bin:${PATH}"

# Create a non-root user
RUN useradd -m -u 1000 -U -s /bin/bash myuser

# Install dependencies
RUN apt-get update && \
    apt-get install -y --no-install-recommends python3-pip python3-dev && \
    rm -rf /var/lib/apt/lists/*

# Set the working directory in the container
RUN mkdir /var/www
ENV HOME=/var/www
WORKDIR /var/www

# Change ownership of /var/www to the non-root user
RUN chown -R myuser:myuser /var/www

# Switch to the non-root user
USER myuser

# Copy the current directory contents into the container at /var/www
COPY . /var/www

# Install Python dependencies
RUN pip install --user -r requirements.txt
RUN pip install --user torch==1.12.1+cu113 -f https://download.pytorch.org/whl/cu113/torch_stable.html

# Expose the port
EXPOSE 7860

RUN mkdir /var/www/logs

# Set environment variables
ENV FLASK_APP=app.py \
    HF_MODEL_NAME="muryshev/e5_large_rus_finetuned_20240202_204910_ep8" \
    ENABLE_LOGS=0 \
    LOGS_BASE_PATH="/var/www/logs"

# Run app.py when the container launches
CMD python3 -m flask run --host=0.0.0.0 --port=7860