Add ability to download a file at container start

This commit is contained in:
Kelson 2020-01-16 14:03:33 +01:00
parent e8b33a7136
commit 7ec2308053
3 changed files with 35 additions and 3 deletions

View File

@ -12,4 +12,7 @@ RUN curl -kL https://download.kiwix.org/release/kiwix-tools/kiwix-tools_linux-x8
EXPOSE 80
VOLUME /data
WORKDIR /data
ENTRYPOINT ["/usr/local/bin/kiwix-serve", "--port", "80"]
COPY ./start.sh /usr/local/bin/
ENTRYPOINT ["/usr/local/bin/start.sh"]

View File

@ -1,13 +1,26 @@
kiwix-serve Docker image
Kiwix serve Docker image
========================
Use with local ZIM file
-----------------------
* Download a ZIM file from <https://wiki.kiwix.org/wiki/Content>
* Given `wikipedia.zim` resides in `/tmp/zim/`, execute the following:
```
```bash
docker run -v /tmp/zim:/data -p 8080:80 kiwix/kiwix-serve wikipedia.zim
```
Use with remote ZIM file
------------------------
```bash
docker run -e "DOWNLOAD=https://download.kiwix.org/zim/wikipedia/wikipedia_bm_all.zim" -p 8080:80 kiwix/kiwix-serve
```
Screenshots
-----------
![screenshot_1.png](https://github.com/kiwix/kiwix-tools/raw/master/docker/server/pictures/screenshot_1.png)
![screenshot_2.png](https://github.com/kiwix/kiwix-tools/raw/master/docker/server/pictures/screenshot_2.png)

16
docker/server/start.sh Executable file
View File

@ -0,0 +1,16 @@
#!/bin/sh
# Download if necessary a file
if [ ! -z "$DOWNLOAD" ]
then
ZIM=`basename $DOWNLOAD`
wget $DOWNLOAD -O "$ZIM"
# Set arguments
if [ "$#" -eq "0" ]
then
set -- "$@" $ZIM
fi
fi
/usr/local/bin/kiwix-serve --port=80 $@