Merge pull request #3 from adampweb/master

Using Docker Compose
This commit is contained in:
Felipe 2025-04-14 12:06:37 -03:00 committed by GitHub
commit dc71d1d167
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 53 additions and 0 deletions

5
.dockerignore Normal file
View File

@ -0,0 +1,5 @@
*.md
*.yml
.github
websites

4
.env.example Normal file
View File

@ -0,0 +1,4 @@
DB_HOST="db"
DB_USER="root"
DB_PASSWORD="example1234"
DB_NAME="wayback"

5
.gitignore vendored
View File

@ -18,6 +18,11 @@ Gemfile.lock
.ruby-version
.rbenv*
## ENV
*.env*
!.env*.example
## RCOV
coverage.data

View File

@ -62,6 +62,23 @@ docker build -t wayback_machine_downloader .
docker run -it --rm wayback_machine_downloader [options] URL
```
### 🐳 Using Docker Compose
We can also use it with Docker Compose, which provides a lot of benefits for extending more functionalities (such as implementing storing previous downloads in a database):
```yaml
# docker-compose.yml
services:
wayback_machine_downloader:
build:
context: .
tty: true
image: wayback_machine_downloader:latest
container_name: wayback_machine_downloader
volumes:
- .:/build:rw
- ./websites:/build/websites:rw
```
## ⚙️ Configuration
There are a few constants that can be edited in the `wayback_machine_downloader.rb` file for your convenience. The default values may be conservative, so you can adjust them to your needs. They are:

13
docker-compose.yml Normal file
View File

@ -0,0 +1,13 @@
services:
wayback_machine_downloader:
build:
context: .
tty: true
image: wayback_machine_downloader:latest
container_name: wayback_machine_downloader
environment:
- ENVIRONMENT=${ENVIRONMENT}
volumes:
- .:/build:rw
- ./websites:/build/websites:rw
command: --directory /build/websites ${OPTIONS} ${TARGET_URL}

9
entrypoint.sh Normal file
View File

@ -0,0 +1,9 @@
#!/bin/bash
if [ "$ENVIRONMENT" == "development" ]; then
echo "Running in development mode. Starting rerun..."
exec rerun --dir /build --ignore "websites/*" -- /build/bin/wayback_machine_downloader "$@"
else
echo "Not in development mode. Skipping rerun."
exec /build/bin/wayback_machine_downloader "$@"
fi