Skip to content

Commit

Permalink
Implemented Docker
Browse files Browse the repository at this point in the history
  • Loading branch information
xy2z committed Jun 23, 2018
1 parent 573c311 commit c335de8
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 0 deletions.
29 changes: 29 additions & 0 deletions Dockerfile
@@ -0,0 +1,29 @@
FROM php:7.2-apache

RUN a2dissite 000-default.conf

# Install php modules
RUN apt-get update \
&& apt-get install libyaml-dev -y \
&& pecl install yaml-2.0.2 \
&& docker-php-ext-enable yaml

# Install Composer
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
RUN apt-get install -y --no-install-recommends git zip unzip

# Data
VOLUME /data
COPY docker /
COPY . /app/pinedocs
# RUN mv /app/pinedocs/docker /
WORKDIR /app/

# Install Composer dependencies
RUN composer install -d=/app/pinedocs

# Override entrypoint
# To make sure data directory exists and symlinks are set when containers are being run.
RUN ["chmod", "+x", "/usr/bin/entrypoint"]
ENTRYPOINT ["/usr/bin/entrypoint"]
CMD ["apache2-foreground"]
14 changes: 14 additions & 0 deletions docker/etc/apache2/sites-enabled/pinedocs.conf
@@ -0,0 +1,14 @@
<VirtualHost *:80>
DocumentRoot /app/pinedocs/public

<Directory /app/pinedocs/public>
Options FollowSymLinks
AllowOverride all
Require all granted
</Directory>

# Possible values include: debug, info, notice, warn, error, crit, alert, emerg.
LogLevel notice

ServerSignature Off
</VirtualHost>
23 changes: 23 additions & 0 deletions docker/usr/bin/entrypoint
@@ -0,0 +1,23 @@
#!/bin/bash

# Config
if [ ! -f /data/pinedocs/config/config.yaml ]; then
mkdir -p /data/pinedocs/config
cp /app/pinedocs/config/config-example.yaml /data/pinedocs/config/config.yaml
echo 'Created config file.'
fi

# Content
if [ ! -f /data/pinedocs/files ]; then
mkdir -p /data/pinedocs/files
cp -a /app/pinedocs/content/. /data/pinedocs/files
echo 'Created content directory.'
fi

# Setup symlinks
rm -rf /app/pinedocs/config /app/pinedocs/content
ln -sfn /data/pinedocs/config /app/pinedocs/config
ln -sfn /data/pinedocs/files /app/pinedocs/content

# Run parent entrypoint
exec /usr/local/bin/docker-php-entrypoint "$@"

0 comments on commit c335de8

Please sign in to comment.