Skip to content

Commit

Permalink
Merge branch 'master' of github.com:modxorg/DocsApp
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark-H committed May 13, 2024
2 parents b80c367 + d1cc108 commit 62358d7
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 4 deletions.
34 changes: 32 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
FROM php:7.1.8-apache
FROM node:16 AS node
FROM php:7.4-rc-apache

ENV APACHE_DOCUMENT_ROOT=/var/www/html/public
RUN sed -ri -e 's!/var/www/html!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/sites-available/*.conf
RUN sed -ri -e 's!/var/www/html!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/apache2.conf /etc/apache2/conf-available/*.conf

COPY --from=node /usr/local/lib/node_modules /usr/local/lib/node_modules
COPY --from=node /usr/local/bin/node /usr/local/bin/node
RUN ln -s /usr/local/lib/node_modules/npm/bin/npm-cli.js /usr/local/bin/npm

# Copy the PHP settings into place
COPY .docker/php.ini /usr/local/etc/php/
Expand All @@ -17,4 +26,25 @@ RUN a2enmod rewrite \
&& a2ensite docs

# Install Git
RUN apt-get update && apt-get install -y git
RUN apt-get update && apt-get install -y --force-yes git zlib1g-dev libicu-dev g++ \
libzip-dev \
zip \
&& docker-php-ext-configure intl \
&& docker-php-ext-install intl \
&& docker-php-ext-configure zip --with-libzip \
&& docker-php-ext-install zip

#Set final permissions
RUN mkdir /var/www/.npm && chown -R www-data:www-data /var/www/.npm

COPY composer.json /var/www/html/composer.json
RUN composer install

COPY docker-entrypoint.sh /entrypoint.sh
RUN ["chmod", "+x", "/entrypoint.sh"]

USER www-data

ENTRYPOINT ["/entrypoint.sh"]
CMD ["apache2-foreground"]

4 changes: 2 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: '2'
version: '3'

services:
docs:
Expand All @@ -11,4 +11,4 @@ services:
- docker=1
- COMPOSER_ALLOW_SUPERUSER=1
volumes:
- .:/var/www/html
- .:/var/www/html
14 changes: 14 additions & 0 deletions docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash
set -e

#cd /var/www/html
#echo "Installing compose dependencies"
#composer install
echo "Init docs and download repos"
php docs.php sources:init
cd /var/www/html/public/template
echo "Install node dependencies and build template"
npm install
npm run build

exec "$@"

0 comments on commit 62358d7

Please sign in to comment.