Spaces:
Runtime error
Runtime error
# Using the Ubuntu image | |
FROM ubuntu:latest | |
# set language, format and stuff | |
ENV LANG=C.UTF-8 LC_ALL=C.UTF-8 | |
# Update package manager (apt-get) | |
RUN apt-get update -y | |
RUN apt-get upgrade -y | |
RUN apt update | |
# installing python3 with a specific version | |
RUN apt install python3.10 -y | |
RUN apt install python3.10-distutils -y | |
#RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.10 1 | |
# installing other libraries | |
RUN apt-get install python3-pip -y && apt-get -y install sudo | |
RUN apt-get install python3-dev -y | |
RUN apt-get install python3-venv -y | |
RUN apt-get install curl -y | |
RUN apt-get install gnupg -y | |
RUN apt-get install nano -y | |
RUN apt-get install ca-certificates -y | |
RUN apt-get update && apt-get install -y git | |
# Create directories and import GPG key | |
RUN mkdir -p /etc/apt/keyrings | |
RUN curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg | |
# Add the Node.js repository | |
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 | |
# Install Node.js | |
RUN apt-get update && apt-get install nodejs -y | |
# Install tweet-harvest@latest | |
RUN npm install -g tweet-harvest@latest | |
RUN npm install -g npm@latest | |
# Set up a new user named "user" with user ID 1000 | |
RUN useradd -m -u 1000 user | |
# Switch to the "user" user | |
USER user | |
# Set home to the user's home directory | |
ENV HOME=/home/user \ | |
PATH=/home/user/.local/bin:$PATH | |
# Download from Github | |
RUN git clone https://github.com/bayhaqy/X-Dashboard.git $HOME/app | |
RUN pwd | |
RUN ls -lhat . | |
RUN ls -lhat $HOME | |
RUN ls -lhat $HOME/app | |
WORKDIR $HOME/app | |
# Add permission | |
RUN chown user $HOME/app | |
RUN chmod -R 777 ${HOME} | |
RUN pwd | |
# Setting virtual environment | |
RUN python3 -m venv .venv | |
ENV PATH="$HOME/app/.venv/bin:$PATH" | |
# Install any needed packages specified in requirements.txt | |
RUN pip install --no-cache-dir --upgrade -r requirements.txt | |
# Try and run pip command after setting the user with `USER user` to avoid permission issues with Python | |
RUN pip install --no-cache-dir --upgrade pip | |
RUN pwd | |
RUN ls -lhat | |
RUN ls -lhat $HOME/app | |
# Check version | |
RUN python3 --version | |
RUN node -v | |
RUN npm list -g | |
# Make port 8501 available to the world outside this container | |
EXPOSE 8501 | |
# Define the command to run your Streamlit app | |
CMD ["streamlit", "run", "app.py"] |