Spaces:
Paused
Paused
Commit
•
a657fe5
1
Parent(s):
14036b7
dockerfile update
Browse files- Dockerfile +41 -15
Dockerfile
CHANGED
@@ -1,28 +1,54 @@
|
|
1 |
-
# Use
|
2 |
FROM python:3.9
|
3 |
|
4 |
# Set environment variables
|
5 |
-
ENV
|
6 |
-
|
7 |
-
|
8 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
WORKDIR /app
|
10 |
|
11 |
-
#
|
12 |
-
|
13 |
-
|
14 |
-
# Copy requirements.txt and install dependencies
|
15 |
-
COPY requirements.txt .
|
16 |
RUN pip install --no-cache-dir -r requirements.txt
|
17 |
|
18 |
-
# Copy the start_server.sh script
|
19 |
-
COPY start_server.sh .
|
20 |
-
|
21 |
-
# Make the script executable
|
22 |
RUN chmod +x start_server.sh
|
23 |
|
24 |
# Expose the MLflow port
|
25 |
EXPOSE 7860
|
26 |
|
27 |
-
#
|
28 |
CMD ["./start_server.sh"]
|
|
|
1 |
+
# Use Python base image
|
2 |
FROM python:3.9
|
3 |
|
4 |
# Set environment variables
|
5 |
+
ENV DEBIAN_FRONTEND=noninteractive \
|
6 |
+
PYTHONUNBUFFERED=1 \
|
7 |
+
SHELL=/bin/bash \
|
8 |
+
TZ=Europe/Paris
|
9 |
+
|
10 |
+
# Install some basic utilities
|
11 |
+
RUN apt-get update && apt-get install -y --no-install-recommends \
|
12 |
+
wget \
|
13 |
+
curl \
|
14 |
+
git \
|
15 |
+
sudo \
|
16 |
+
procps \
|
17 |
+
git-lfs \
|
18 |
+
zip \
|
19 |
+
unzip \
|
20 |
+
htop \
|
21 |
+
vim \
|
22 |
+
nano \
|
23 |
+
bzip2 \
|
24 |
+
build-essential \
|
25 |
+
libsndfile-dev \
|
26 |
+
&& rm -rf /var/lib/apt/lists/*
|
27 |
+
|
28 |
+
# Create a non-root user and switch to it
|
29 |
+
RUN adduser --disabled-password --gecos '' --shell /bin/bash user \
|
30 |
+
&& chown -R user:user /app
|
31 |
+
RUN echo "user ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/90-user
|
32 |
+
USER user
|
33 |
+
|
34 |
+
# All users can use /home/user as their home directory
|
35 |
+
ENV HOME=/home/user
|
36 |
+
RUN mkdir -p $HOME/.cache $HOME/.config /data \
|
37 |
+
&& chmod -R 777 $HOME /data
|
38 |
+
|
39 |
+
# Set the working directory to /app
|
40 |
WORKDIR /app
|
41 |
|
42 |
+
# Copy requirements.txt and install dependencies as the non-root user
|
43 |
+
COPY --chown=user requirements.txt .
|
|
|
|
|
|
|
44 |
RUN pip install --no-cache-dir -r requirements.txt
|
45 |
|
46 |
+
# Copy the start_server.sh script and make it executable
|
47 |
+
COPY --chown=user start_server.sh .
|
|
|
|
|
48 |
RUN chmod +x start_server.sh
|
49 |
|
50 |
# Expose the MLflow port
|
51 |
EXPOSE 7860
|
52 |
|
53 |
+
# Start the MLflow server using the start_server.sh script
|
54 |
CMD ["./start_server.sh"]
|