File size: 1,272 Bytes
9e70bac
 
 
 
 
 
 
 
 
 
 
 
 
 
9e22d78
9e70bac
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
d8a44b5
9e70bac
 
 
 
 
 
 
 
9e22d78
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
# Use an official Python runtime as a parent image
FROM python:3.11.1

# Set up user
RUN useradd -m -u 1000 user
USER user

# Install Cargo (Rust's package manager), needed for hf_transfer
# RUN curl https://sh.rustup.rs -sSf | sh -s -- -y

# Set up environment variables
# ENV HOME=/home/user \
#     PATH=/home/user/.local/bin:/home/user/.cargo/bin:$PATH
ENV HOME=/home/user \
    PATH=/home/user/.local/bin:$PATH

# Set the working directory in the container
WORKDIR $HOME/app

# Copy the current directory contents into the container at /home/user/app
COPY --chown=user . $HOME/app

# Set user to root
USER root

# Install any needed packages specified in requirements.txt
RUN python -m venv /venv && \
    /venv/bin/pip install --no-cache-dir -r requirements.txt

# Fix broken OpenCV installation for docker container
# RUN apt-get update && apt-get install -y libgl1 && apt-get install -y python3-opencv 
# RUN /venv/bin/pip install opencv-python

# Set user back to non-root
USER user 

# Make port 80 available to the world outside this container
EXPOSE 80

# Generate requirements.txt using pip freeze
RUN /venv/bin/pip freeze > requirements.txt

# Run train_llm.py when the container launches
CMD ["/bin/bash", "-c", "source /venv/bin/activate && python app.py"]