Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Dieken committed Nov 28, 2022
1 parent 34663ca commit 351439b
Show file tree
Hide file tree
Showing 4 changed files with 419 additions and 0 deletions.
67 changes: 67 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
FROM debian:11

ARG url=https://github.com/foswiki/distro/releases/download/FoswikiRelease02x01x07/Foswiki-2.1.7.tgz
ARG sha512=7196ce5a586a3770e2d198a79d0856f34724893746a40500b7f72d3efc48dcbdfb0292a3583186cf4e5b217a70df3b5dd8af80aa3e5c34987ca202a62dada0bf
ARG root=/var/www/foswiki
ARG user=www-data
ARG group=www-data
ARG port=80
ARG lang=C.UTF-8
ARG tz=Asia/Shanghai
ARG mirror

ENV LANG=$lang TZ=$tz

RUN set -eux; \
[ -z "$mirror" ] || sed -i -E "s|http(s?)://deb.debian.org|$mirror|" /etc/apt/sources.list; \
apt update -y \
&& apt install -y curl diffutils grep less logrotate vim w3m \
apache2 libapache2-mod-perl2 \
libalgorithm-diff-perl \
libapache2-request-perl \
libarchive-zip-perl \
libcgi-session-perl \
libconvert-pem-perl \
libcrypt-eksblowfish-perl \
libcrypt-passwdmd5-perl \
libcrypt-smime-perl \
libcrypt-x509-perl \
libdbd-mariadb-perl \
libdbd-mysql-perl \
libdbd-pg-perl \
libdbd-sqlite3-perl \
libemail-address-xs-perl \
libemail-mime-perl \
libemail-simple-perl \
liberror-perl \
libfcgi-procmanager-perl \
libfile-copy-recursive-perl \
libjson-perl \
liblocale-codes-perl \
liblocale-maketext-lexicon-perl \
liblocale-msgfmt-perl \
&& apt install -y --no-install-recommends \
libimage-magick-perl \
&& rm -rf /var/lib/apt/lists/* \
&& a2enmod access_compat perl rewrite \
&& a2dissite 000-default

COPY foswiki.conf /etc/apache2/sites-enabled/

RUN set -eux; \
mkdir -p $root \
&& cd $root \
&& curl -L -s -o foswiki.tgz "$url" \
&& echo "$sha512 foswiki.tgz" > foswiki.tgz.sha512 \
&& sha512sum -c --status foswiki.tgz.sha512 \
&& tar -xzvf foswiki.tgz --strip-components=1 \
&& rm foswiki.tgz foswiki.tgz.sha512 \
&& sh tools/fix_file_permissions.sh \
&& chown -R $user:$group $root \
&& echo "0,30 * * * * cd $root/bin && perl ../tools/tick_foswiki.pl" | crontab -u $user -

VOLUME $root

EXPOSE $port

CMD ["/bin/sh", "-c", "service cron start && exec apache2ctl -DFOREGROUND -k start"]
21 changes: 21 additions & 0 deletions docker/LICENCE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2022 Yubao Liu

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
44 changes: 44 additions & 0 deletions docker/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Dockerfile for Foswiki

Run pristine Foswiki in Debian container with Apache 2 and mod_perl.

## Build

```sh
docker build . -t foswiki --progress plain

```

Notice this Dockerfile uses volume for `/var/www/foswiki`.

## Run

```sh
docker run -dt --init --name foswiki -p 8888:80 -e TZ=Asia/Shanghai foswiki
```

Access http://localhost:8888 to further configure Foswiki:

1. http://localhost:8888/bin/configure Security and Authentication -> Registration: select `Enable User Registration` and click button `Save 1 change` on the top right corner
2. http://localhost:8888/System/UserRegistration Register your first user, such as WikiName `FirstAdmin`
3. http://localhost:8888/Main/WikiGroups Click `Add Members...` in the group `AdminGroup`, add newly registered user's WikiName
4. Run `docker restart foswiki` to restart the Docker container

Although you can directly access Foswiki in the container, this container is expected to be behind a reverse proxy that terminates HTTPS connections and handles virtual site, you must replace the hostname above to `https://your-reverse-proxy?SSL=1`.

## Install extension

``` sh
su -s /bin/bash www-data
cd /var/www/foswiki
tools/extension_installer NatSkin -r install
```

Check https://foswiki.org/Extensions for more extensions.

## Reference

* https://github.com/timlegge/docker-foswiki
* https://foswiki.org/System/InstallationGuide
* https://foswiki.org/System/InstallationGuidePart2

Loading

0 comments on commit 351439b

Please sign in to comment.