Browse Source

dont depend on README in Dockerfile install step

Nick Sweeting 4 years ago
parent
commit
2fc9f1cfa3
4 changed files with 24 additions and 24 deletions
  1. 2 1
      Dockerfile
  2. 5 3
      README.md
  3. 11 11
      archivebox/main.py
  4. 6 9
      docker-compose.yml

+ 2 - 1
Dockerfile

@@ -73,10 +73,11 @@ ENV PATH="${PATH}:$VENV_PATH/bin"
 RUN python -m venv --clear --symlinks "$VENV_PATH" \
 RUN python -m venv --clear --symlinks "$VENV_PATH" \
     && pip install --upgrade --quiet pip setuptools
     && pip install --upgrade --quiet pip setuptools
 ADD "./setup.py" "$CODE_DIR/"
 ADD "./setup.py" "$CODE_DIR/"
-ADD "./README.md" "./package.json" "$CODE_DIR/archivebox/"
+ADD "./package.json" "$CODE_DIR/archivebox/"
 RUN apt-get update -qq \
 RUN apt-get update -qq \
     && apt-get install -qq -y --no-install-recommends \
     && apt-get install -qq -y --no-install-recommends \
         build-essential python-dev python3-dev \
         build-essential python-dev python3-dev \
+    && echo 'empty placeholder for setup.py to use' > "$CODE_DIR/archivebox/README.md" \
     && python3 -c 'from distutils.core import run_setup; result = run_setup("./setup.py", stop_after="init"); print("\n".join(result.install_requires + result.extras_require["sonic"]))' > /tmp/requirements.txt \
     && python3 -c 'from distutils.core import run_setup; result = run_setup("./setup.py", stop_after="init"); print("\n".join(result.install_requires + result.extras_require["sonic"]))' > /tmp/requirements.txt \
     && pip install --quiet -r /tmp/requirements.txt \
     && pip install --quiet -r /tmp/requirements.txt \
     && apt-get purge -y build-essential python-dev python3-dev \
     && apt-get purge -y build-essential python-dev python3-dev \

+ 5 - 3
README.md

@@ -110,7 +110,7 @@ curl -O 'https://raw.githubusercontent.com/ArchiveBox/ArchiveBox/master/docker-c
 
 
 Start the server.
 Start the server.
 <pre lang="bash"><code style="white-space: pre-line">
 <pre lang="bash"><code style="white-space: pre-line">
-docker-compose run --rm archivebox init --setup
+docker-compose run archivebox init --setup
 docker-compose up
 docker-compose up
 </code></pre>
 </code></pre>
 
 
@@ -651,11 +651,13 @@ archivebox --version
 # if you edit e.g. ./archivebox/core/models.py on the docker host, runserver
 # if you edit e.g. ./archivebox/core/models.py on the docker host, runserver
 # inside the container will reload and pick up your changes
 # inside the container will reload and pick up your changes
 docker build . -t archivebox
 docker build . -t archivebox
-docker run -it --rm archivebox version
-docker run -it --rm -p 8000:8000 \
+docker run -it archivebox init --setup
+docker run -it -p 8000:8000 \
     -v $PWD/data:/data \
     -v $PWD/data:/data \
     -v $PWD/archivebox:/app/archivebox \
     -v $PWD/archivebox:/app/archivebox \
     archivebox server 0.0.0.0:8000 --debug --reload
     archivebox server 0.0.0.0:8000 --debug --reload
+
+# (remove the --reload flag and add the --nothreading flag when profiling with the django debug toolbar)
 ```
 ```
 
 
 ### Common development tasks
 ### Common development tasks

+ 11 - 11
archivebox/main.py

@@ -437,17 +437,6 @@ def init(force: bool=False, quick: bool=False, setup: bool=False, out_dir: Path=
         print('{green}[√] Done. Verified and updated the existing ArchiveBox collection.{reset}'.format(**ANSI))
         print('{green}[√] Done. Verified and updated the existing ArchiveBox collection.{reset}'.format(**ANSI))
     else:
     else:
         print('{green}[√] Done. A new ArchiveBox collection was initialized ({} links).{reset}'.format(len(all_links) + len(pending_links), **ANSI))
         print('{green}[√] Done. A new ArchiveBox collection was initialized ({} links).{reset}'.format(len(all_links) + len(pending_links), **ANSI))
-    
-    if Snapshot.objects.count() < 25:     # hide the hints for experienced users
-        print()
-        print('    {lightred}Hint:{reset} To view your archive index, run:'.format(**ANSI))
-        print('        archivebox server  # then visit http://127.0.0.1:8000')
-        print()
-        print('    To add new links, you can run:')
-        print("        archivebox add ~/some/path/or/url/to/list_of_links.txt")
-        print()
-        print('    For more usage and examples, run:')
-        print('        archivebox help')
 
 
     json_index = out_dir / JSON_INDEX_FILENAME
     json_index = out_dir / JSON_INDEX_FILENAME
     html_index = out_dir / HTML_INDEX_FILENAME
     html_index = out_dir / HTML_INDEX_FILENAME
@@ -459,6 +448,17 @@ def init(force: bool=False, quick: bool=False, setup: bool=False, out_dir: Path=
 
 
     if setup:
     if setup:
         run_subcommand('setup', pwd=out_dir)
         run_subcommand('setup', pwd=out_dir)
+    
+    if Snapshot.objects.count() < 25:     # hide the hints for experienced users
+        print()
+        print('    {lightred}Hint:{reset} To view your archive index, run:'.format(**ANSI))
+        print('        archivebox server  # then visit http://127.0.0.1:8000')
+        print()
+        print('    To add new links, you can run:')
+        print("        archivebox add ~/some/path/or/url/to/list_of_links.txt")
+        print()
+        print('    For more usage and examples, run:')
+        print('        archivebox help')
 
 
 @enforce_types
 @enforce_types
 def status(out_dir: Path=OUTPUT_DIR) -> None:
 def status(out_dir: Path=OUTPUT_DIR) -> None:

+ 6 - 9
docker-compose.yml

@@ -1,6 +1,6 @@
 # Usage:
 # Usage:
-#     docker-compose up -d
-#     docker-compose run archivebox init
+#     docker-compose run archivebox init --setup
+#     docker-compose up
 #     echo "https://example.com" | docker-compose run archivebox archivebox add
 #     echo "https://example.com" | docker-compose run archivebox archivebox add
 #     docker-compose run archivebox add --depth=1 https://example.com/some/feed.rss
 #     docker-compose run archivebox add --depth=1 https://example.com/some/feed.rss
 #     docker-compose run archivebox config --set PUBLIC_INDEX=True
 #     docker-compose run archivebox config --set PUBLIC_INDEX=True
@@ -12,23 +12,20 @@ version: '3.7'
 services:
 services:
     archivebox:
     archivebox:
         # build: .                              # for developers working on archivebox
         # build: .                              # for developers working on archivebox
-        image: ${DOCKER_IMAGE:-archivebox/archivebox:latest} 
+        image: ${DOCKER_IMAGE:-archivebox/archivebox:latest}
         command: server --quick-init 0.0.0.0:8000
         command: server --quick-init 0.0.0.0:8000
-        stdin_open: true
-        tty: true
         ports:
         ports:
             - 8000:8000
             - 8000:8000
         environment:
         environment:
             - ALLOWED_HOSTS=*                   # add any config options you want as env vars
             - ALLOWED_HOSTS=*                   # add any config options you want as env vars
             - MEDIA_MAX_SIZE=750m
             - MEDIA_MAX_SIZE=750m
-            # - SHOW_PROGRESS=False
             # - SEARCH_BACKEND_ENGINE=sonic     # uncomment these if you enable sonic below
             # - SEARCH_BACKEND_ENGINE=sonic     # uncomment these if you enable sonic below
             # - SEARCH_BACKEND_HOST_NAME=sonic
             # - SEARCH_BACKEND_HOST_NAME=sonic
             # - SEARCH_BACKEND_PASSWORD=SecretPassword
             # - SEARCH_BACKEND_PASSWORD=SecretPassword
         volumes:
         volumes:
             - ./data:/data
             - ./data:/data
             # - ./archivebox:/app/archivebox    # for developers working on archivebox
             # - ./archivebox:/app/archivebox    # for developers working on archivebox
-    
+
     # To run the Sonic full-text search backend, first download the config file to sonic.cfg
     # To run the Sonic full-text search backend, first download the config file to sonic.cfg
     # curl https://raw.githubusercontent.com/ArchiveBox/ArchiveBox/master/etc/sonic/config.cfg > sonic.cfg
     # curl https://raw.githubusercontent.com/ArchiveBox/ArchiveBox/master/etc/sonic/config.cfg > sonic.cfg
     # sonic:
     # sonic:
@@ -54,7 +51,7 @@ services:
     #        - SHOW_PROGRESS=False
     #        - SHOW_PROGRESS=False
     #    volumes:
     #    volumes:
     #        - ./data:/data
     #        - ./data:/data
-    
+
     # Example: Put Nginx in front of the ArchiveBox server for SSL termination
     # Example: Put Nginx in front of the ArchiveBox server for SSL termination
     # nginx:
     # nginx:
     #     image: nginx:alpine
     #     image: nginx:alpine
@@ -78,7 +75,7 @@ services:
     #   volumes:
     #   volumes:
     #     - /lib/modules:/lib/modules
     #     - /lib/modules:/lib/modules
     #     - ./wireguard.conf:/config/wg0.conf:ro
     #     - ./wireguard.conf:/config/wg0.conf:ro
-    
+
     # Example: Run PYWB in parallel and auto-import WARCs from ArchiveBox
     # Example: Run PYWB in parallel and auto-import WARCs from ArchiveBox
     # pywb:
     # pywb:
     #     image: webrecorder/pywb:latest
     #     image: webrecorder/pywb:latest