Spaces:
Runtime error
Runtime error
Update Dockerfile: Set up user, environment variables, and working directory
Browse files- Dockerfile +19 -9
Dockerfile
CHANGED
@@ -1,18 +1,28 @@
|
|
1 |
# Use an official Python runtime as a parent image
|
2 |
FROM python:3.11.1
|
3 |
|
4 |
-
# Set
|
5 |
-
|
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 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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
|
@@ -21,7 +31,7 @@ RUN pip install --no-cache-dir -r requirements.txt
|
|
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"]
|
|
|
1 |
# Use an official Python runtime as a parent image
|
2 |
FROM python:3.11.1
|
3 |
|
4 |
+
# Set up user
|
5 |
+
RUN useradd -m -u 1000 user
|
6 |
+
USER user
|
|
|
|
|
7 |
|
8 |
+
# Install Cargo (Rust's package manager), needed for hf_transfer
|
9 |
RUN curl https://sh.rustup.rs -sSf | sh -s -- -y
|
10 |
+
|
11 |
+
# Set up environment variables
|
12 |
+
ENV HOME=/home/user \
|
13 |
+
PATH=/home/user/.local/bin:$PATH \
|
14 |
+
PATH=/home/user/.cargo/bin:$PATH
|
15 |
+
|
16 |
+
# Set the working directory in the container
|
17 |
+
# WORKDIR /usr/src/app
|
18 |
+
WORKDIR $HOME/app
|
19 |
|
20 |
# Copy the current directory contents into the container at /usr/src/app
|
21 |
+
# COPY . /usr/src/app
|
22 |
+
COPY --chown=user . $HOME/app
|
23 |
+
|
24 |
+
# Set user to root
|
25 |
+
# USER root
|
26 |
|
27 |
# Install any needed packages specified in requirements.txt
|
28 |
RUN pip install --no-cache-dir -r requirements.txt
|
|
|
31 |
EXPOSE 80
|
32 |
|
33 |
# Define environment variable
|
34 |
+
# ENV NAME World
|
35 |
|
36 |
# Run train_llm.py when the container launches
|
37 |
CMD ["python", "./train_llm.py"]
|