deployment/dev improvements; add Dockerfile
This commit is contained in:
parent
053ebb2c5c
commit
ac43988c55
3 changed files with 59 additions and 0 deletions
21
Dockerfile
Normal file
21
Dockerfile
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
FROM php:7.2-apache
|
||||||
|
|
||||||
|
COPY www/ /var/www/html/
|
||||||
|
RUN rm -f /var/www/html/pile.db
|
||||||
|
COPY opt/ /opt/pile
|
||||||
|
RUN mkdir -p /var/tmp/pile
|
||||||
|
COPY db_versions/ /var/tmp/pile/db_versions
|
||||||
|
|
||||||
|
RUN apt-get update && apt-get -y install sqlite3 wget \
|
||||||
|
libfreetype6-dev \
|
||||||
|
libjpeg62-turbo-dev \
|
||||||
|
libpng-dev
|
||||||
|
|
||||||
|
RUN docker-php-ext-install -j$(nproc) iconv \
|
||||||
|
&& docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ \
|
||||||
|
&& docker-php-ext-install -j$(nproc) gd
|
||||||
|
|
||||||
|
RUN cd /opt/pile/ && /opt/pile/install_composer.sh
|
||||||
|
RUN cd /var/www/html && /opt/pile/composer.phar install
|
||||||
|
|
||||||
|
RUN /var/tmp/pile/db_versions/apply_all.sh /var/www/html/pile.db
|
21
db_versions/apply_all.sh
Executable file
21
db_versions/apply_all.sh
Executable file
|
@ -0,0 +1,21 @@
|
||||||
|
#!/bin/bash
|
||||||
|
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
|
||||||
|
|
||||||
|
if [ -z "$1" ]; then
|
||||||
|
echo "Please specify database file."
|
||||||
|
exit -1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! which sqlite3; then
|
||||||
|
echo "Couldn't find \`sqlite3\` in \$PATH!"
|
||||||
|
exit -1
|
||||||
|
fi
|
||||||
|
|
||||||
|
set -e
|
||||||
|
FILES=$(ls ${DIR}/*.sql|sort)
|
||||||
|
for sql_file in $FILES;do
|
||||||
|
echo "Processing \"${sql_file}\"..."
|
||||||
|
sqlite3 -echo "$1" < "$sql_file"
|
||||||
|
done
|
||||||
|
|
||||||
|
echo "Done."
|
17
opt/install_composer.sh
Executable file
17
opt/install_composer.sh
Executable file
|
@ -0,0 +1,17 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
EXPECTED_SIGNATURE="$(wget -q -O - https://composer.github.io/installer.sig)"
|
||||||
|
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
|
||||||
|
ACTUAL_SIGNATURE="$(php -r "echo hash_file('sha384', 'composer-setup.php');")"
|
||||||
|
|
||||||
|
if [ "$EXPECTED_SIGNATURE" != "$ACTUAL_SIGNATURE" ]
|
||||||
|
then
|
||||||
|
>&2 echo 'ERROR: Invalid installer signature'
|
||||||
|
rm composer-setup.php
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
php composer-setup.php --quiet
|
||||||
|
RESULT=$?
|
||||||
|
rm composer-setup.php
|
||||||
|
exit $RESULT
|
Loading…
Reference in a new issue