X-Dashboard / Dockerfile
Bayhaqy's picture
Update Dockerfile
5a925a3 verified
# Using the Ubuntu image
FROM ubuntu:latest
# Set language, format and stuff
ENV LANG=C.UTF-8 LC_ALL=C.UTF-8 \
DEBIAN_FRONTEND=noninteractive
# Update package manager and install basic dependencies
RUN apt-get update -y && \
apt-get upgrade -y && \
apt-get install -y --no-install-recommends \
python3.12 \
python3-pip \
python3-dev \
python3-venv \
curl \
gnupg \
nano \
ca-certificates \
git \
sudo \
&& rm -rf /var/lib/apt/lists/*
# Create directories and import GPG key for Node.js
RUN mkdir -p /etc/apt/keyrings && \
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 and npm
RUN apt-get update && \
apt-get install -y nodejs && \
rm -rf /var/lib/apt/lists/*
# Install tweet-harvest and update npm
RUN npm install -g tweet-harvest@latest npm@latest
# Create and switch to a non-root user (using the first available UID)
RUN adduser --disabled-password --gecos '' appuser && \
mkdir -p /home/appuser/app && \
chown -R appuser:appuser /home/appuser
# Switch to the appuser
USER appuser
# Set environment variables
ENV HOME=/home/appuser \
PATH=/home/appuser/.local/bin:$PATH
WORKDIR $HOME/app
# Clone repository
RUN git clone https://github.com/bayhaqy/X-Dashboard.git .
# Create virtual environment
RUN python3 -m venv .venv
ENV PATH="$HOME/app/.venv/bin:$PATH"
# Upgrade pip and install requirements
RUN pip install --no-cache-dir --upgrade pip && \
pip install --no-cache-dir -r requirements.txt
# Check versions (for debugging, remove in production)
RUN python3 --version && \
node -v && \
npm list -g
# Expose port
EXPOSE 8501
# Define the command to run your Streamlit app
CMD ["streamlit", "run", "app.py"]