dsmueller commited on
Commit
89b4019
1 Parent(s): b814438

Update Dockerfile and requirements.txt

Browse files
Files changed (3) hide show
  1. Dockerfile +15 -36
  2. Dockerfile_old +48 -0
  3. requirements.txt +1 -1
Dockerfile CHANGED
@@ -1,48 +1,27 @@
1
  # Use an official Python runtime as a parent image
2
  FROM python:3.11.1
3
 
4
- # Set up user and paths
5
- RUN useradd -m -u 1000 user
6
- USER user
7
- ENV HOME=/home/user \
8
- PATH=/home/user/.local/bin:$PATH
9
-
10
- # WORKDIR $HOME/app
11
- # COPY --chown=user . $HOME/app
12
-
13
  # Set the working directory in the container
14
- # WORKDIR /app
15
- WORKDIR $HOME/app
16
-
17
- # Copy the current directory contents into the container at /usr/src/app
18
- # COPY . .
19
- COPY --chown=user . $HOME/app
20
 
21
- # Switch to root user
22
  USER root
23
 
24
- # Install Rust and Cargo, Reqirements, and Python dependencies
25
- RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y && \
26
- export PATH="/root/.cargo/bin:${PATH}" && \
27
- pip install --upgrade pip && \
28
- pip install -r requirements.txt
29
-
30
- # Make a port available to the world outside this container
31
- # 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.
32
- EXPOSE 8501
33
 
34
- # 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:
35
- HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health
36
 
37
- # Set the permissions for the script file
38
- # RUN chmod +x python 3 train_llm.py
39
 
40
- # Change permissions of the working directory
41
- # RUN chmod 777 /app # Gives all users read, write, and exec permissions in the app directory.
42
 
43
- # Run the command inside your image filesystem.
44
- CMD ["python", "train_llm.py"]
45
 
46
- # Execute with:
47
- # docker build -t <image_name> .
48
- # docker run -p 8501:8501 <image_name>
 
1
  # Use an official Python runtime as a parent image
2
  FROM python:3.11.1
3
 
 
 
 
 
 
 
 
 
 
4
  # Set the working directory in the container
5
+ WORKDIR /usr/src/app
 
 
 
 
 
6
 
7
+ # Set user to root
8
  USER root
9
 
10
+ # Install Cargo (Rust's package manager)
11
+ RUN curl https://sh.rustup.rs -sSf | sh -s -- -y
12
+ ENV PATH="/root/.cargo/bin:${PATH}"
 
 
 
 
 
 
13
 
14
+ # Copy the current directory contents into the container at /usr/src/app
15
+ COPY . /usr/src/app
16
 
17
+ # Install any needed packages specified in requirements.txt
18
+ RUN pip install --no-cache-dir -r requirements.txt
19
 
20
+ # Make port 80 available to the world outside this container
21
+ EXPOSE 80
22
 
23
+ # Define environment variable
24
+ ENV NAME World
25
 
26
+ # Run train_llm.py when the container launches
27
+ CMD ["python", "./train_llm.py"]
 
Dockerfile_old ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Use an official Python runtime as a parent image
2
+ FROM python:3.11.1
3
+
4
+ # Set up user and paths
5
+ RUN useradd -m -u 1000 user
6
+ USER user
7
+ ENV HOME=/home/user \
8
+ PATH=/home/user/.local/bin:$PATH
9
+
10
+ # WORKDIR $HOME/app
11
+ # COPY --chown=user . $HOME/app
12
+
13
+ # Set the working directory in the container
14
+ # WORKDIR /app
15
+ WORKDIR $HOME/app
16
+
17
+ # Copy the current directory contents into the container at /usr/src/app
18
+ # COPY . .
19
+ COPY --chown=user . $HOME/app
20
+
21
+ # Switch to root user
22
+ USER root
23
+
24
+ # Install Rust and Cargo, Reqirements, and Python dependencies
25
+ RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y && \
26
+ export PATH="/root/.cargo/bin:${PATH}" && \
27
+ pip install --upgrade pip && \
28
+ pip install -r requirements.txt
29
+
30
+ # Make a port available to the world outside this container
31
+ # 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.
32
+ EXPOSE 8501
33
+
34
+ # 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:
35
+ HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health
36
+
37
+ # Set the permissions for the script file
38
+ # RUN chmod +x python 3 train_llm.py
39
+
40
+ # Change permissions of the working directory
41
+ # RUN chmod 777 /app # Gives all users read, write, and exec permissions in the app directory.
42
+
43
+ # Run the command inside your image filesystem.
44
+ CMD ["python", "train_llm.py"]
45
+
46
+ # Execute with:
47
+ # docker build -t <image_name> .
48
+ # docker run -p 8501:8501 <image_name>
requirements.txt CHANGED
@@ -74,7 +74,7 @@ networkx==3.2.1
74
  nltk==3.8.1
75
  numpy==1.26.2
76
  oauthlib==3.2.2
77
- opencv-python==4.8.1.78
78
  opencv-python-headless==4.8.1.78
79
  optuna==3.3.0
80
  orjson==3.9.10
 
74
  nltk==3.8.1
75
  numpy==1.26.2
76
  oauthlib==3.2.2
77
+ # opencv-python==4.8.1.78
78
  opencv-python-headless==4.8.1.78
79
  optuna==3.3.0
80
  orjson==3.9.10