Skip to content

Commit

Permalink
Add container support
Browse files Browse the repository at this point in the history
  • Loading branch information
martin-v committed Jul 18, 2021
1 parent 7c9addb commit 5719dd8
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 0 deletions.
22 changes: 22 additions & 0 deletions Containerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
FROM php:7-apache

RUN docker-php-ext-install exif

RUN set -eux; \
\
apt-get update; \
apt-get install -y --no-install-recommends git; \
rm -rf /var/lib/apt/lists/*; \
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false

COPY --chown=www-data:www-data . /var/www/html

RUN set -eux; \
\
sed -i "s/BASE_PATH \\. //" /var/www/html/config.php; \
sed -i "s/'GIT_COMMIT_ENABLED', false/'GIT_COMMIT_ENABLED', true/" /var/www/html/config.php

VOLUME /pages
EXPOSE 80

CMD /var/www/html/container-start.sh
22 changes: 22 additions & 0 deletions container-start.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/bash
set -e

# on empty volume copy default pages
if ! test -f /pages/Home.md ; then
cp /var/www/html/pages/* /pages

(
cd /pages
git init
git config user.email "w2wiki@w2wiki"
git config user.name "w2wiki"

git add -A .
git commit -m "Init with default pages"
)
fi

mkdir -p /pages/images
chown -R www-data:www-data /pages

exec apache2-foreground "$@"

0 comments on commit 5719dd8

Please sign in to comment.