Spaces:
Sleeping
Sleeping
ignore temp files
Browse files- Dockerfile +46 -11
Dockerfile
CHANGED
@@ -1,24 +1,59 @@
|
|
1 |
# Use an official Python runtime as a parent image
|
2 |
FROM python:3.12-slim
|
3 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
# Set the working directory in the container
|
5 |
WORKDIR /app
|
6 |
|
7 |
# Install system dependencies
|
8 |
-
RUN apt-get update && apt-get install -y \
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
|
15 |
# Copy the current directory contents into the container at /app
|
16 |
-
COPY . /app
|
17 |
|
18 |
-
RUN useradd -m -u 1000 user
|
19 |
-
COPY --chown=user . /app
|
20 |
-
# Install any needed packages specified in requirements.txt
|
21 |
-
RUN pip install --no-cache-dir -r requirements.txt
|
22 |
|
23 |
# Make port 7680 available to the world outside this container
|
24 |
EXPOSE 7860
|
|
|
1 |
# Use an official Python runtime as a parent image
|
2 |
FROM python:3.12-slim
|
3 |
|
4 |
+
### Set up user with permissions
|
5 |
+
# Set up a new user named "user" with user ID 1000
|
6 |
+
RUN useradd -m -u 1000 user
|
7 |
+
|
8 |
+
# Switch to the "user" user
|
9 |
+
USER user
|
10 |
+
|
11 |
+
# Set home to the user's home directory
|
12 |
+
ENV HOME=/home/user \
|
13 |
+
PATH=/home/user/.local/bin:$PATH
|
14 |
+
|
15 |
+
# Set the working directory to the user's home directory
|
16 |
+
WORKDIR $HOME/app
|
17 |
+
|
18 |
+
# RUN apt-get update && apt-get install -y \
|
19 |
+
# gcc \
|
20 |
+
# build-essential \
|
21 |
+
# pkg-config \
|
22 |
+
# libhdf5-dev \
|
23 |
+
# && rm -rf /var/lib/apt/lists/*
|
24 |
+
|
25 |
+
# Copy the current directory contents into the container at $HOME/app setting the owner to the user
|
26 |
+
COPY --chown=user . $HOME/app
|
27 |
+
|
28 |
+
### Set up app-specific content
|
29 |
+
COPY requirements.txt requirements.txt
|
30 |
+
RUN pip install --no-cache-dir -r requirements.txt
|
31 |
+
|
32 |
+
COPY . .
|
33 |
+
|
34 |
+
### Update permissions for the app
|
35 |
+
USER root
|
36 |
+
RUN chmod 777 ~/app/*
|
37 |
+
USER user
|
38 |
+
|
39 |
# Set the working directory in the container
|
40 |
WORKDIR /app
|
41 |
|
42 |
# Install system dependencies
|
43 |
+
# RUN apt-get update && apt-get install -y \
|
44 |
+
# gcc \
|
45 |
+
# build-essential \
|
46 |
+
# pkg-config \
|
47 |
+
# libhdf5-dev \
|
48 |
+
# && rm -rf /var/lib/apt/lists/*
|
49 |
|
50 |
# Copy the current directory contents into the container at /app
|
51 |
+
# COPY . /app
|
52 |
|
53 |
+
# RUN useradd -m -u 1000 user
|
54 |
+
# COPY --chown=user . /app
|
55 |
+
# # Install any needed packages specified in requirements.txt
|
56 |
+
# RUN pip install --no-cache-dir -r requirements.txt
|
57 |
|
58 |
# Make port 7680 available to the world outside this container
|
59 |
EXPOSE 7860
|