Spaces:
Build error
Build error
Update Dockerfile
Browse files- Dockerfile +51 -72
Dockerfile
CHANGED
@@ -1,93 +1,72 @@
|
|
1 |
# Using the Ubuntu image
|
2 |
FROM ubuntu:latest
|
3 |
|
4 |
-
#
|
5 |
-
ENV LANG=C.UTF-8 LC_ALL=C.UTF-8
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
RUN apt-get
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
RUN
|
26 |
-
|
27 |
-
# Create directories and import GPG key
|
28 |
-
RUN mkdir -p /etc/apt/keyrings
|
29 |
-
RUN curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg
|
30 |
|
31 |
# Add the Node.js repository
|
32 |
RUN echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_20.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list
|
33 |
|
34 |
-
# Install Node.js
|
35 |
-
RUN apt-get update &&
|
|
|
|
|
36 |
|
37 |
-
# Install tweet-harvest
|
38 |
-
RUN npm install -g tweet-harvest@latest
|
39 |
-
RUN npm install -g npm@latest
|
40 |
|
41 |
-
#
|
42 |
-
RUN
|
|
|
|
|
43 |
|
44 |
-
# Switch to the
|
45 |
-
USER
|
46 |
|
47 |
-
# Set
|
48 |
-
ENV HOME=/home/
|
49 |
-
PATH=/home/
|
50 |
-
|
51 |
-
# Download from Github
|
52 |
-
RUN git clone https://github.com/bayhaqy/X-Dashboard.git $HOME/app
|
53 |
-
|
54 |
-
RUN pwd
|
55 |
-
|
56 |
-
RUN ls -lhat .
|
57 |
-
|
58 |
-
RUN ls -lhat $HOME
|
59 |
-
|
60 |
-
RUN ls -lhat $HOME/app
|
61 |
|
62 |
WORKDIR $HOME/app
|
63 |
|
64 |
-
#
|
65 |
-
RUN
|
66 |
-
RUN chmod -R 777 ${HOME}
|
67 |
-
|
68 |
-
RUN pwd
|
69 |
-
|
70 |
-
# Setting virtual environment
|
71 |
-
RUN python3 -m venv .venv
|
72 |
-
ENV PATH="$HOME/app/.venv/bin:$PATH"
|
73 |
-
|
74 |
-
# Install any needed packages specified in requirements.txt
|
75 |
-
RUN pip install --no-cache-dir --upgrade -r requirements.txt
|
76 |
-
|
77 |
-
# Try and run pip command after setting the user with `USER user` to avoid permission issues with Python
|
78 |
-
RUN pip install --no-cache-dir --upgrade pip
|
79 |
|
80 |
-
|
|
|
|
|
81 |
|
82 |
-
|
83 |
-
RUN
|
|
|
84 |
|
85 |
-
# Check
|
86 |
-
RUN python3 --version
|
87 |
-
|
88 |
-
|
89 |
|
90 |
-
#
|
91 |
EXPOSE 8501
|
92 |
|
93 |
# Define the command to run your Streamlit app
|
|
|
1 |
# Using the Ubuntu image
|
2 |
FROM ubuntu:latest
|
3 |
|
4 |
+
# Set language, format and stuff
|
5 |
+
ENV LANG=C.UTF-8 LC_ALL=C.UTF-8 \
|
6 |
+
DEBIAN_FRONTEND=noninteractive
|
7 |
+
|
8 |
+
# Update package manager and install basic dependencies
|
9 |
+
RUN apt-get update -y && \
|
10 |
+
apt-get upgrade -y && \
|
11 |
+
apt-get install -y --no-install-recommends \
|
12 |
+
python3.12 \
|
13 |
+
python3-pip \
|
14 |
+
python3-dev \
|
15 |
+
python3-venv \
|
16 |
+
curl \
|
17 |
+
gnupg \
|
18 |
+
nano \
|
19 |
+
ca-certificates \
|
20 |
+
git \
|
21 |
+
sudo \
|
22 |
+
&& rm -rf /var/lib/apt/lists/*
|
23 |
+
|
24 |
+
# Create directories and import GPG key for Node.js
|
25 |
+
RUN mkdir -p /etc/apt/keyrings && \
|
26 |
+
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg
|
|
|
|
|
|
|
27 |
|
28 |
# Add the Node.js repository
|
29 |
RUN echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_20.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list
|
30 |
|
31 |
+
# Install Node.js and npm
|
32 |
+
RUN apt-get update && \
|
33 |
+
apt-get install -y nodejs && \
|
34 |
+
rm -rf /var/lib/apt/lists/*
|
35 |
|
36 |
+
# Install tweet-harvest and update npm
|
37 |
+
RUN npm install -g tweet-harvest@latest npm@latest
|
|
|
38 |
|
39 |
+
# Create and switch to a non-root user (using the first available UID)
|
40 |
+
RUN adduser --disabled-password --gecos '' appuser && \
|
41 |
+
mkdir -p /home/appuser/app && \
|
42 |
+
chown -R appuser:appuser /home/appuser
|
43 |
|
44 |
+
# Switch to the appuser
|
45 |
+
USER appuser
|
46 |
|
47 |
+
# Set environment variables
|
48 |
+
ENV HOME=/home/appuser \
|
49 |
+
PATH=/home/appuser/.local/bin:$PATH
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
50 |
|
51 |
WORKDIR $HOME/app
|
52 |
|
53 |
+
# Clone repository
|
54 |
+
RUN git clone https://github.com/bayhaqy/X-Dashboard.git .
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
55 |
|
56 |
+
# Create virtual environment
|
57 |
+
RUN python3 -m venv .venv
|
58 |
+
ENV PATH="$HOME/app/.venv/bin:$PATH"
|
59 |
|
60 |
+
# Upgrade pip and install requirements
|
61 |
+
RUN pip install --no-cache-dir --upgrade pip && \
|
62 |
+
pip install --no-cache-dir -r requirements.txt
|
63 |
|
64 |
+
# Check versions (for debugging, remove in production)
|
65 |
+
RUN python3 --version && \
|
66 |
+
node -v && \
|
67 |
+
npm list -g
|
68 |
|
69 |
+
# Expose port
|
70 |
EXPOSE 8501
|
71 |
|
72 |
# Define the command to run your Streamlit app
|