mirror of
https://github.com/leoncvlt/loconotion.git
synced 2024-08-30 18:12:12 +00:00
Added Dockerfile, docker-compose and fixed init_chromedriver
This commit is contained in:
parent
c1329e050c
commit
b7ce8d6714
11
docker-compose.yml
Normal file
11
docker-compose.yml
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
version: "3"
|
||||||
|
|
||||||
|
services:
|
||||||
|
loconotion:
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
dockerfile: docker/Dockerfile
|
||||||
|
image: loconotion:latest
|
||||||
|
volumes:
|
||||||
|
- ${LOCONOTION_LOCAL_DIST:-/tmp/}:/app/loconotion/dist
|
||||||
|
restart: always
|
32
docker/Dockerfile
Normal file
32
docker/Dockerfile
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
FROM python:3.8
|
||||||
|
|
||||||
|
# ChromeDriver installation from https://gist.github.com/varyonic/dea40abcf3dd891d204ef235c6e8dd79
|
||||||
|
# We need wget to set up the PPA and xvfb to have a virtual screen and unzip to install the Chromedriver
|
||||||
|
RUN apt-get update
|
||||||
|
RUN apt-get install -y libgconf-2-4 wget xvfb unzip
|
||||||
|
# Set up the Chrome PPA
|
||||||
|
RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -
|
||||||
|
RUN echo "deb http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list
|
||||||
|
# Update the package list and install chrome
|
||||||
|
RUN apt-get update -y
|
||||||
|
RUN apt-get install -y google-chrome-stable
|
||||||
|
|
||||||
|
# RUN wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
|
||||||
|
# RUN dpkg -i google-chrome-stable_current_amd64.deb; apt-get -fy install
|
||||||
|
# Set up Chromedriver Environment variables
|
||||||
|
ENV CHROMEDRIVER_VERSION 85.0.4183.38
|
||||||
|
ENV CHROMEDRIVER_DIR /chromedriver
|
||||||
|
RUN mkdir $CHROMEDRIVER_DIR
|
||||||
|
# Download and install Chromedriver
|
||||||
|
RUN wget -q --continue -P $CHROMEDRIVER_DIR "https://chromedriver.storage.googleapis.com/$CHROMEDRIVER_VERSION/chromedriver_linux64.zip"
|
||||||
|
RUN unzip $CHROMEDRIVER_DIR/chromedriver* -d $CHROMEDRIVER_DIR
|
||||||
|
# Put Chromedriver into the PATH
|
||||||
|
ENV PATH $CHROMEDRIVER_DIR:$PATH
|
||||||
|
|
||||||
|
RUN mkdir -p /app/loconotion/
|
||||||
|
WORKDIR /app/loconotion/
|
||||||
|
COPY requirements.txt .
|
||||||
|
RUN pip install -r requirements.txt
|
||||||
|
|
||||||
|
COPY . .
|
||||||
|
ENTRYPOINT [ "python", "loconotion", "--chromedriver", "/chromedriver/chromedriver"]
|
@ -228,6 +228,8 @@ class Parser:
|
|||||||
if not self.args.get("non_headless", False):
|
if not self.args.get("non_headless", False):
|
||||||
chrome_options.add_argument("--headless")
|
chrome_options.add_argument("--headless")
|
||||||
chrome_options.add_argument("window-size=1920,1080")
|
chrome_options.add_argument("window-size=1920,1080")
|
||||||
|
chrome_options.add_argument('--no-sandbox')
|
||||||
|
chrome_options.add_argument('--disable-dev-shm-usage')
|
||||||
chrome_options.add_argument("--log-level=3")
|
chrome_options.add_argument("--log-level=3")
|
||||||
chrome_options.add_argument("--silent")
|
chrome_options.add_argument("--silent")
|
||||||
chrome_options.add_argument("--disable-logging")
|
chrome_options.add_argument("--disable-logging")
|
||||||
|
Loading…
Reference in New Issue
Block a user