File size: 1,617 Bytes
89b4019
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 python:3.11.1

# Set up user and paths
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

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

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

# Switch to root user
USER root

# Install Rust and Cargo, Reqirements, and Python dependencies
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y && \
    export PATH="/root/.cargo/bin:${PATH}" && \
    pip install --upgrade pip && \
    pip install -r requirements.txt

# Make a port available to the world outside this container
# The EXPOSE instruction informs Docker that the container listens on the specified network ports at runtime. Your container needs to listen to Streamlit’s (default) port 8501.
EXPOSE 8501

# The HEALTHCHECK instruction tells Docker how to test a container to check that it is still working. Your container needs to listen to Streamlit’s (default) port 8501:
HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health

# Set the permissions for the script file
# RUN chmod +x python 3 train_llm.py

# Change permissions of the working directory
# RUN chmod 777 /app  # Gives all users read, write, and exec permissions in the app directory.

# Run the command inside your image filesystem.
CMD ["python", "train_llm.py"]

# Execute with:
# docker build -t <image_name> .    
# docker run -p 8501:8501 <image_name>