Bayhaqy commited on
Commit
ad50e6b
1 Parent(s): 954fa0f

Create Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +94 -0
Dockerfile ADDED
@@ -0,0 +1,94 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+
7
+ # Update package manager (apt-get)
8
+ RUN apt-get update -y
9
+ RUN apt-get upgrade -y
10
+ RUN apt update
11
+
12
+ # installing python3 with a specific version
13
+ RUN apt install python3.10 -y
14
+ RUN apt install python3.10-distutils -y
15
+ #RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.10 1
16
+
17
+ # installing other libraries
18
+ RUN apt-get install python3-pip -y && apt-get -y install sudo
19
+ RUN apt-get install python3-dev -y
20
+ RUN apt-get install python3-venv -y
21
+ RUN apt-get install curl -y
22
+ RUN apt-get install gnupg -y
23
+ RUN apt-get install nano -y
24
+ RUN apt-get install ca-certificates -y
25
+ RUN apt-get update && apt-get install -y git
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 && apt-get install nodejs -y
36
+
37
+ # Install tweet-harvest@latest
38
+ RUN npm install -g tweet-harvest@latest
39
+ RUN npm install -g npm@latest
40
+
41
+ # Set up a new user named "user" with user ID 1000
42
+ RUN useradd -m -u 1000 user
43
+
44
+ # Switch to the "user" user
45
+ USER user
46
+
47
+ # Set home to the user's home directory
48
+ ENV HOME=/home/user \
49
+ PATH=/home/user/.local/bin:$PATH
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
+ # Add permission
65
+ RUN chown user $HOME/app
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
+ RUN pwd
81
+
82
+ RUN ls -lhat
83
+ RUN ls -lhat $HOME/app
84
+
85
+ # Check version
86
+ RUN python3 --version
87
+ RUN node -v
88
+ RUN npm list -g
89
+
90
+ # Make port 8501 available to the world outside this container
91
+ EXPOSE 8501
92
+
93
+ # Define the command to run your Streamlit app
94
+ CMD ["streamlit", "run", "app.py"]