Browse Source

fix etc nginx and Docker config

Nick Sweeting 7 years ago
parent
commit
ea905d68bb
5 changed files with 74 additions and 15 deletions
  1. 1 0
      .dockerignore
  2. 3 5
      Dockerfile
  3. 25 0
      docker-compose.yml
  4. 0 10
      etc/nginx/conf.d/archivebox.conf
  5. 45 0
      etc/nginx/nginx.conf

+ 1 - 0
.dockerignore

@@ -3,3 +3,4 @@ __pycache__
 .DS_Store
 venv
 .venv
+data

+ 3 - 5
Dockerfile

@@ -21,7 +21,8 @@ RUN apt-get update && apt-get install -y curl --no-install-recommends \
 # RUN chmod +x /usr/local/bin/dumb-init
 
 RUN git clone https://github.com/pirate/ArchiveBox /home/chromeuser/app \
-    && pip3 install -r /home/chromeuser/app/archivebox/requirements.txt
+    && pip3 install -r /home/chromeuser/app/archivebox/requirements.txt \
+    && ln -s /home/chromeuser/app/bin/archivebox /usr/bin/archive
 
 # Add user so we area strong, independent chrome that don't need --no-sandbox.
 RUN groupadd -r chromeuser && useradd -r -g chromeuser -G audio,video chromeuser \
@@ -43,7 +44,4 @@ ENV LANG=en_US.UTF-8 \
 USER chromeuser
 WORKDIR /home/chromeuser/app
 
-# ENTRYPOINT ["dumb-init", "--"]
-# CMD ["/home/chromeuser/app/archive"]
-
-ENTRYPOINT ["python3", "-u", "/home/chromeuser/app/archivebox/archive.py"]
+CMD ["/usr/bin/archive"]

+ 25 - 0
docker-compose.yml

@@ -0,0 +1,25 @@
+version: '3'
+
+services:
+    archivebox:
+        build: .
+        stdin_open: true
+        tty: true
+        environment:
+            - FETCH_SCREENSHOT=False
+            - FETCH_PDF=False
+            - FETCH_DOM=False
+            - FETCH_MEDIA=False
+            - USE_COLOR=False
+            - SHOW_PROGRESS=False
+        volumes:
+            - ./data:/data
+        command: bash -c 'echo "https://example.com" | /usr/bin/archive; tail -f /dev/null'
+
+    nginx:
+        image: 'nginx'
+        ports:
+            - '8098:80'
+        volumes:
+            - ./etc/nginx/nginx.conf:/etc/nginx/nginx.conf
+            - ./data:/var/www

+ 0 - 10
etc/nginx/conf.d/archivebox.conf

@@ -1,10 +0,0 @@
-server {
-    listen                      80 default_server;
-    server_name                 _;
-
-    root                        /opt/ArchiveBox/output/;
-    index                       index.html;
-    autoindex                   on;
-
-    try_files                   $uri $uri/ $uri.html =404;
-}

+ 45 - 0
etc/nginx/nginx.conf

@@ -0,0 +1,45 @@
+user www-data;
+pid                                 /var/run/nginx.pid;
+
+worker_processes                    auto;
+timer_resolution                    100ms;
+
+worker_rlimit_nofile                40000;
+events {
+    worker_connections              40000;
+    use epoll;
+    multi_accept on;
+}
+
+http {
+    sendfile on;
+    tcp_nopush on;
+    tcp_nodelay on;
+    server_tokens off;
+    send_timeout 20;
+    keepalive_timeout 65;
+    types_hash_max_size 2048;
+    client_max_body_size 25m;
+
+    include                     mime.types;
+    default_type                application/octet-stream;
+
+    access_log                  /dev/stdout;
+    error_log                   stderr;
+
+    reset_timedout_connection on;
+
+    server_names_hash_bucket_size   64;
+
+    server {
+        listen                      80 default_server;
+        server_name                 _;
+
+        root                        /var/www;
+        index                       index.html;
+        autoindex                   on;
+
+        try_files                   $uri $uri/ $uri.html =404;
+    }
+}
+