pepe / Dockerfile
gadisk820's picture
Upload 21 files
c547afa verified
FROM python:3.9-slim
# Install dependencies + xvfb + Chrome dependencies
RUN apt-get update && apt-get install -y \
curl \
wget \
gnupg \
ca-certificates \
xvfb \
bash \
gconf-service \
libasound2 \
libatk1.0-0 \
libc6 \
libcairo2 \
libcups2 \
libdbus-1-3 \
libexpat1 \
libfontconfig1 \
libgbm1 \
libgcc1 \
libgconf-2-4 \
libgdk-pixbuf2.0-0 \
libglib2.0-0 \
libgtk-3-0 \
libnspr4 \
libpango-1.0-0 \
libpangocairo-1.0-0 \
libstdc++6 \
libx11-6 \
libx11-xcb1 \
libxcb1 \
libxcomposite1 \
libxcursor1 \
libxdamage1 \
libxext6 \
libxfixes3 \
libxi6 \
libxrandr2 \
libxrender1 \
libxss1 \
libxtst6 \
fonts-liberation \
libappindicator1 \
libnss3 \
lsb-release \
xdg-utils \
wget \
&& rm -rf /var/lib/apt/lists/*
# Install Chrome
RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \
&& echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list \
&& apt-get update \
&& apt-get install -y google-chrome-stable \
--no-install-recommends \
&& rm -rf /var/lib/apt/lists/* \
&& rm -rf /src/*.deb
WORKDIR /app
# Python deps (jika masih dipakai)
COPY requirements.txt .
RUN pip install --no-cache-dir --upgrade pip && \
pip install --no-cache-dir -r requirements.txt || true
# Install 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 \
&& echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] \
https://deb.nodesource.com/node_20.x nodistro main" \
> /etc/apt/sources.list.d/nodesource.list \
&& apt-get update \
&& apt-get install -y nodejs \
&& rm -rf /var/lib/apt/lists/*
# Copy API
COPY Api/ /app/Api/
WORKDIR /app/Api
# Install puppeteer dependencies dengan chromium dari system (bukan download)
RUN npm install --omit=dev \
&& npm install puppeteer@21.3.8 \
&& npm install puppeteer-real-browser@1.2.6
WORKDIR /app
# Copy script bot
COPY claim-5.sh .
RUN chmod +x claim-5.sh
# Set environment variables for Puppeteer
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true
ENV PUPPETEER_EXECUTABLE_PATH=/usr/bin/google-chrome-stable
ENV DISPLAY=:99
ENV CHROME_PATH=/usr/bin/google-chrome-stable
ENV LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu/
# Create a non-root user untuk puppeteer
RUN groupadd -r pptruser && useradd -r -g pptruser -G audio,video pptruser \
&& mkdir -p /home/pptruser/Downloads \
&& chown -R pptruser:pptruser /home/pptruser \
&& chown -R pptruser:pptruser /app
# Startup script yang diperbaiki
RUN echo '#!/bin/bash\n\
echo "🤖 STARTING FAUCET BOT"\n\
echo "Starting Xvfb..."\n\
Xvfb :99 -screen 0 1024x768x16 &\n\
sleep 2\n\
echo "Starting Node API..."\n\
cd /app/Api\n\
su pptruser -c "node Api.js" &\n\
sleep 5\n\
echo "Starting claim script..."\n\
cd /app\n\
su pptruser -c "./claim-5.sh"\n\
' > /start.sh && chmod +x /start.sh
EXPOSE 7860
USER pptruser
CMD ["/start.sh"]