Spaces:
Sleeping
Sleeping
MekkCyber
commited on
Commit
·
4905514
1
Parent(s):
957fac4
update
Browse files- Dockerfile +13 -13
- app.py +1 -1
Dockerfile
CHANGED
@@ -12,32 +12,32 @@ RUN apt-get update && \
|
|
12 |
rm -rf /var/lib/apt/lists/*
|
13 |
|
14 |
# Create a non-root user (do this as root)
|
15 |
-
RUN useradd -ms /bin/bash
|
16 |
|
17 |
# Set the working directory as root before switching users
|
18 |
-
WORKDIR /home/
|
19 |
|
20 |
# Copy files and change permissions as root
|
21 |
-
COPY requirements.txt /home/
|
22 |
-
COPY setup.sh /home/
|
23 |
-
RUN chmod +x /home/
|
24 |
|
25 |
# Install Python dependencies as root
|
26 |
-
RUN pip install --no-cache-dir -r /home/
|
27 |
|
28 |
# Run setup.sh as root (if it needs elevated privileges)
|
29 |
-
RUN /home/
|
30 |
|
31 |
-
# Change ownership of the directory to
|
32 |
-
RUN chown -R
|
33 |
|
34 |
# Switch to the non-root user
|
35 |
-
USER
|
36 |
|
37 |
|
38 |
-
RUN ls /home/
|
39 |
-
# Copy the rest of the application code to the container (as
|
40 |
-
COPY . /home/
|
41 |
|
42 |
# Expose the necessary port
|
43 |
EXPOSE 7860
|
|
|
12 |
rm -rf /var/lib/apt/lists/*
|
13 |
|
14 |
# Create a non-root user (do this as root)
|
15 |
+
RUN useradd -ms /bin/bash user
|
16 |
|
17 |
# Set the working directory as root before switching users
|
18 |
+
WORKDIR /home/user/app
|
19 |
|
20 |
# Copy files and change permissions as root
|
21 |
+
COPY requirements.txt /home/user/app/requirements.txt
|
22 |
+
COPY setup.sh /home/user/app/setup.sh
|
23 |
+
RUN chmod +x /home/user/app/setup.sh
|
24 |
|
25 |
# Install Python dependencies as root
|
26 |
+
RUN pip install --no-cache-dir -r /home/user/app/requirements.txt
|
27 |
|
28 |
# Run setup.sh as root (if it needs elevated privileges)
|
29 |
+
RUN /home/user/app/setup.sh
|
30 |
|
31 |
+
# Change ownership of the directory to user
|
32 |
+
RUN chown -R user:user /home/user/app
|
33 |
|
34 |
# Switch to the non-root user
|
35 |
+
USER user
|
36 |
|
37 |
|
38 |
+
RUN ls /home/user/app
|
39 |
+
# Copy the rest of the application code to the container (as user)
|
40 |
+
COPY . /home/user/app
|
41 |
|
42 |
# Expose the necessary port
|
43 |
EXPOSE 7860
|
app.py
CHANGED
@@ -9,7 +9,7 @@ import logging
|
|
9 |
logging.basicConfig(level=logging.INFO)
|
10 |
|
11 |
# Path to the cloned repository
|
12 |
-
BITNET_REPO_PATH = "/home/
|
13 |
SETUP_SCRIPT = os.path.join(BITNET_REPO_PATH, "setup_env.py")
|
14 |
INFERENCE_SCRIPT = os.path.join(BITNET_REPO_PATH, "run_inference.py")
|
15 |
|
|
|
9 |
logging.basicConfig(level=logging.INFO)
|
10 |
|
11 |
# Path to the cloned repository
|
12 |
+
BITNET_REPO_PATH = "/home/user/app/BitNet"
|
13 |
SETUP_SCRIPT = os.path.join(BITNET_REPO_PATH, "setup_env.py")
|
14 |
INFERENCE_SCRIPT = os.path.join(BITNET_REPO_PATH, "run_inference.py")
|
15 |
|