commit
1cf93524b3
15 changed files with 61 additions and 68 deletions
99
Dockerfile
99
Dockerfile
|
@ -12,18 +12,26 @@ RUN composer update --ignore-platform-reqs --optimize-autoloader \
|
||||||
--no-plugins --no-scripts --prefer-dist \
|
--no-plugins --no-scripts --prefer-dist \
|
||||||
`if [ "$TESTING" != "true" ]; then echo "--no-dev"; fi`
|
`if [ "$TESTING" != "true" ]; then echo "--no-dev"; fi`
|
||||||
|
|
||||||
FROM php:7.4-cli as step1
|
FROM php:7.4-cli-alpine as step1
|
||||||
|
|
||||||
ENV TZ=Asia/Tel_Aviv \
|
ENV TZ=Asia/Tel_Aviv \
|
||||||
DEBIAN_FRONTEND=noninteractive \
|
|
||||||
PHP_REDIS_VERSION=5.3.0 \
|
PHP_REDIS_VERSION=5.3.0 \
|
||||||
PHP_SWOOLE_VERSION=4.5.2 \
|
PHP_SWOOLE_VERSION=4.5.2 \
|
||||||
PHP_XDEBUG_VERSION=sdebug_2_9-beta
|
PHP_XDEBUG_VERSION=sdebug_2_9-beta
|
||||||
|
|
||||||
RUN \
|
RUN \
|
||||||
apt-get update && \
|
apk add --no-cache --virtual .deps \
|
||||||
apt-get install -y --no-install-recommends --no-install-suggests ca-certificates software-properties-common wget git openssl make zip unzip libbrotli-dev libz-dev
|
make \
|
||||||
|
automake \
|
||||||
|
autoconf \
|
||||||
|
gcc \
|
||||||
|
g++ \
|
||||||
|
tar \
|
||||||
|
wget \
|
||||||
|
git \
|
||||||
|
zlib-dev \
|
||||||
|
brotli-dev
|
||||||
|
|
||||||
RUN docker-php-ext-install sockets
|
RUN docker-php-ext-install sockets
|
||||||
|
|
||||||
RUN \
|
RUN \
|
||||||
|
@ -43,31 +51,14 @@ RUN \
|
||||||
./configure --enable-sockets --enable-http2 && \
|
./configure --enable-sockets --enable-http2 && \
|
||||||
make && make install && \
|
make && make install && \
|
||||||
cd ..
|
cd ..
|
||||||
## XDebug Extension
|
|
||||||
# git clone https://github.com/swoole/sdebug.git && \
|
|
||||||
# cd sdebug && \
|
|
||||||
# git checkout $PHP_XDEBUG_VERSION && \
|
|
||||||
# phpize && \
|
|
||||||
# ./configure --enable-xdebug && \
|
|
||||||
# make clean && make && make install
|
|
||||||
# cd .. && \
|
|
||||||
# Meminfo Extension
|
|
||||||
# git clone https://github.com/BitOne/php-meminfo.git && \
|
|
||||||
# cd php-meminfo && \
|
|
||||||
# git checkout v1.0.5 && \
|
|
||||||
# cd extension/php7 && \
|
|
||||||
# phpize && \
|
|
||||||
# ./configure --enable-meminfo && \
|
|
||||||
# make && make install
|
|
||||||
|
|
||||||
FROM php:7.4-cli as final
|
FROM php:7.4-cli-alpine as final
|
||||||
|
|
||||||
LABEL maintainer="team@appwrite.io"
|
LABEL maintainer="team@appwrite.io"
|
||||||
|
|
||||||
ARG VERSION=dev
|
ARG VERSION=dev
|
||||||
|
|
||||||
ENV TZ=Asia/Tel_Aviv \
|
ENV TZ=Asia/Tel_Aviv \
|
||||||
DEBIAN_FRONTEND=noninteractive \
|
|
||||||
_APP_SERVER=swoole \
|
_APP_SERVER=swoole \
|
||||||
_APP_ENV=production \
|
_APP_ENV=production \
|
||||||
_APP_DOMAIN=localhost \
|
_APP_DOMAIN=localhost \
|
||||||
|
@ -103,21 +94,31 @@ ENV TZ=Asia/Tel_Aviv \
|
||||||
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
|
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
|
||||||
|
|
||||||
RUN \
|
RUN \
|
||||||
apt-get update && \
|
apk update \
|
||||||
apt-get install -y --no-install-recommends --no-install-suggests webp certbot htop procps docker.io \
|
&& apk add --no-cache --virtual .deps \
|
||||||
libonig-dev libcurl4-gnutls-dev libmagickwand-dev libyaml-dev libbrotli-dev libz-dev && \
|
make \
|
||||||
pecl install imagick yaml && \
|
automake \
|
||||||
docker-php-ext-enable imagick yaml
|
autoconf \
|
||||||
|
gcc \
|
||||||
RUN docker-php-ext-install sockets curl opcache pdo pdo_mysql
|
g++ \
|
||||||
|
curl-dev \
|
||||||
|
&& apk add --no-cache \
|
||||||
|
libstdc++ \
|
||||||
|
yaml-dev \
|
||||||
|
imagemagick \
|
||||||
|
imagemagick-dev \
|
||||||
|
certbot \
|
||||||
|
docker-cli \
|
||||||
|
&& pecl install imagick yaml \
|
||||||
|
&& docker-php-ext-enable imagick yaml \
|
||||||
|
&& docker-php-ext-install sockets opcache pdo_mysql \
|
||||||
|
&& apk del .deps
|
||||||
|
|
||||||
WORKDIR /usr/src/code
|
WORKDIR /usr/src/code
|
||||||
|
|
||||||
COPY --from=step0 /usr/local/src/vendor /usr/src/code/vendor
|
COPY --from=step0 /usr/local/src/vendor /usr/src/code/vendor
|
||||||
COPY --from=step1 /usr/local/lib/php/extensions/no-debug-non-zts-20190902/swoole.so /usr/local/lib/php/extensions/no-debug-non-zts-20190902/
|
COPY --from=step1 /usr/local/lib/php/extensions/no-debug-non-zts-20190902/swoole.so /usr/local/lib/php/extensions/no-debug-non-zts-20190902/
|
||||||
COPY --from=step1 /usr/local/lib/php/extensions/no-debug-non-zts-20190902/redis.so /usr/local/lib/php/extensions/no-debug-non-zts-20190902/
|
COPY --from=step1 /usr/local/lib/php/extensions/no-debug-non-zts-20190902/redis.so /usr/local/lib/php/extensions/no-debug-non-zts-20190902/
|
||||||
# COPY --from=step1 /usr/local/lib/php/extensions/no-debug-non-zts-20190902/xdebug.so /usr/local/lib/php/extensions/no-debug-non-zts-20190902/
|
|
||||||
# COPY --from=step1 /usr/local/lib/php/extensions/no-debug-non-zts-20190902/meminfo.so /usr/local/lib/php/extensions/no-debug-non-zts-20190902/
|
|
||||||
|
|
||||||
# Add Source Code
|
# Add Source Code
|
||||||
COPY ./app /usr/src/code/app
|
COPY ./app /usr/src/code/app
|
||||||
|
@ -141,18 +142,18 @@ RUN mkdir -p /storage/uploads && \
|
||||||
chown -Rf www-data.www-data /storage/debug && chmod -Rf 0755 /storage/debug
|
chown -Rf www-data.www-data /storage/debug && chmod -Rf 0755 /storage/debug
|
||||||
|
|
||||||
# Executables
|
# Executables
|
||||||
RUN chmod +x /usr/local/bin/doctor
|
RUN chmod +x /usr/local/bin/doctor && \
|
||||||
RUN chmod +x /usr/local/bin/migrate
|
chmod +x /usr/local/bin/migrate && \
|
||||||
RUN chmod +x /usr/local/bin/schedule
|
chmod +x /usr/local/bin/schedule && \
|
||||||
RUN chmod +x /usr/local/bin/test
|
chmod +x /usr/local/bin/test && \
|
||||||
RUN chmod +x /usr/local/bin/worker-audits
|
chmod +x /usr/local/bin/worker-audits && \
|
||||||
RUN chmod +x /usr/local/bin/worker-certificates
|
chmod +x /usr/local/bin/worker-certificates && \
|
||||||
RUN chmod +x /usr/local/bin/worker-deletes
|
chmod +x /usr/local/bin/worker-deletes && \
|
||||||
RUN chmod +x /usr/local/bin/worker-functions
|
chmod +x /usr/local/bin/worker-functions && \
|
||||||
RUN chmod +x /usr/local/bin/worker-mails
|
chmod +x /usr/local/bin/worker-mails && \
|
||||||
RUN chmod +x /usr/local/bin/worker-tasks
|
chmod +x /usr/local/bin/worker-tasks && \
|
||||||
RUN chmod +x /usr/local/bin/worker-usage
|
chmod +x /usr/local/bin/worker-usage && \
|
||||||
RUN chmod +x /usr/local/bin/worker-webhooks
|
chmod +x /usr/local/bin/worker-webhooks
|
||||||
|
|
||||||
# Letsencrypt Permissions
|
# Letsencrypt Permissions
|
||||||
RUN mkdir -p /etc/letsencrypt/live/ && chmod -Rf 755 /etc/letsencrypt/live/
|
RUN mkdir -p /etc/letsencrypt/live/ && chmod -Rf 755 /etc/letsencrypt/live/
|
||||||
|
@ -160,21 +161,11 @@ RUN mkdir -p /etc/letsencrypt/live/ && chmod -Rf 755 /etc/letsencrypt/live/
|
||||||
# Enable Extensions
|
# Enable Extensions
|
||||||
RUN echo extension=swoole.so >> /usr/local/etc/php/conf.d/swoole.ini
|
RUN echo extension=swoole.so >> /usr/local/etc/php/conf.d/swoole.ini
|
||||||
RUN echo extension=redis.so >> /usr/local/etc/php/conf.d/redis.ini
|
RUN echo extension=redis.so >> /usr/local/etc/php/conf.d/redis.ini
|
||||||
# RUN echo zend_extension=xdebug.so >> /usr/local/etc/php/conf.d/xdebug.ini
|
|
||||||
# RUN echo extension=meminfo.so >> /usr/local/etc/php/conf.d/meminfo.ini
|
|
||||||
|
|
||||||
RUN echo "opcache.preload_user=www-data" >> /usr/local/etc/php/conf.d/appwrite.ini
|
RUN echo "opcache.preload_user=www-data" >> /usr/local/etc/php/conf.d/appwrite.ini
|
||||||
RUN echo "opcache.preload=/usr/src/code/app/preload.php" >> /usr/local/etc/php/conf.d/appwrite.ini
|
RUN echo "opcache.preload=/usr/src/code/app/preload.php" >> /usr/local/etc/php/conf.d/appwrite.ini
|
||||||
RUN echo "opcache.enable_cli = 1" >> /usr/local/etc/php/conf.d/appwrite.ini
|
RUN echo "opcache.enable_cli = 1" >> /usr/local/etc/php/conf.d/appwrite.ini
|
||||||
# RUN echo "xdebug.profiler_enable = 1" >> /usr/local/etc/php/conf.d/appwrite.ini
|
|
||||||
# RUN echo "xdebug.profiler_output_dir = /tmp/" >> /usr/local/etc/php/conf.d/appwrite.ini
|
|
||||||
# RUN echo "xdebug.profiler_enable_trigger = 1" >> /usr/local/etc/php/conf.d/appwrite.ini
|
|
||||||
# RUN echo "xdebug.trace_format = 1" >> /usr/local/etc/php/conf.d/appwrite.ini
|
|
||||||
|
|
||||||
EXPOSE 80
|
EXPOSE 80
|
||||||
|
|
||||||
#, "-dxdebug.auto_trace=1"
|
|
||||||
#, "-dxdebug.profiler_enable=1"
|
|
||||||
#, "-dopcache.preload=opcache.preload=/usr/src/code/app/preload.php"
|
|
||||||
|
|
||||||
CMD [ "php", "app/server.php", "-dopcache.preload=opcache.preload=/usr/src/code/app/preload.php" ]
|
CMD [ "php", "app/server.php", "-dopcache.preload=opcache.preload=/usr/src/code/app/preload.php" ]
|
||||||
|
|
|
@ -92,6 +92,8 @@ ENV TZ=Asia/Tel_Aviv \
|
||||||
_APP_STATSD_PORT=8125 \
|
_APP_STATSD_PORT=8125 \
|
||||||
_APP_SMTP_HOST=smtp \
|
_APP_SMTP_HOST=smtp \
|
||||||
_APP_SMTP_PORT=25 \
|
_APP_SMTP_PORT=25 \
|
||||||
|
_APP_FUNCTIONS_TIMEOUT=900 \
|
||||||
|
_APP_FUNCTIONS_CONTAINERS=10 \
|
||||||
_APP_SETUP=self-hosted \
|
_APP_SETUP=self-hosted \
|
||||||
_APP_VERSION=$VERSION
|
_APP_VERSION=$VERSION
|
||||||
#ENV _APP_SMTP_SECURE ''
|
#ENV _APP_SMTP_SECURE ''
|
||||||
|
@ -175,4 +177,4 @@ EXPOSE 80
|
||||||
#, "-dxdebug.profiler_enable=1"
|
#, "-dxdebug.profiler_enable=1"
|
||||||
#, "-dopcache.preload=opcache.preload=/usr/src/code/app/preload.php"
|
#, "-dopcache.preload=opcache.preload=/usr/src/code/app/preload.php"
|
||||||
|
|
||||||
CMD [ "php", "app/server.php", "-dopcache.preload=opcache.preload=/usr/src/code/app/preload.php" ]
|
CMD [ "php", "app/server.php", "-dopcache.preload=opcache.preload=/usr/src/code/app/preload.php" ]
|
|
@ -1,3 +1,3 @@
|
||||||
#!/bin/bash
|
#!/bin/sh
|
||||||
|
|
||||||
php /usr/src/code/app/tasks/init.php doctor
|
php /usr/src/code/app/tasks/init.php doctor
|
|
@ -1,3 +1,3 @@
|
||||||
#!/bin/bash
|
#!/bin/sh
|
||||||
|
|
||||||
php /usr/src/code/app/tasks/migrate.php run
|
php /usr/src/code/app/tasks/migrate.php run
|
|
@ -1,3 +1,3 @@
|
||||||
#!/bin/bash
|
#!/bin/sh
|
||||||
|
|
||||||
REDIS_BACKEND="${_APP_REDIS_HOST}:${_APP_REDIS_PORT}" RESQUE_PHP='/usr/src/code/vendor/autoload.php' php /usr/src/code/vendor/bin/resque-scheduler
|
REDIS_BACKEND="${_APP_REDIS_HOST}:${_APP_REDIS_PORT}" RESQUE_PHP='/usr/src/code/vendor/autoload.php' php /usr/src/code/vendor/bin/resque-scheduler
|
|
@ -1,4 +1,4 @@
|
||||||
#!/bin/bash
|
#!/bin/sh
|
||||||
|
|
||||||
export PHP_VERSION=$PHP_VERSION
|
export PHP_VERSION=$PHP_VERSION
|
||||||
|
|
||||||
|
|
2
bin/test
2
bin/test
|
@ -1,3 +1,3 @@
|
||||||
#!/bin/bash
|
#!/bin/sh
|
||||||
|
|
||||||
/usr/src/code/vendor/bin/phpunit --configuration /usr/src/code/phpunit.xml
|
/usr/src/code/vendor/bin/phpunit --configuration /usr/src/code/phpunit.xml
|
|
@ -1,3 +1,3 @@
|
||||||
#!/bin/bash
|
#!/bin/sh
|
||||||
|
|
||||||
QUEUE='v1-audits' APP_INCLUDE='/usr/src/code/app/workers/audits.php' REDIS_BACKEND="${_APP_REDIS_HOST}:${_APP_REDIS_PORT}" php /usr/src/code/vendor/bin/resque -dopcache.preload=opcache.preload=/usr/src/code/app/preload.php
|
QUEUE='v1-audits' APP_INCLUDE='/usr/src/code/app/workers/audits.php' REDIS_BACKEND="${_APP_REDIS_HOST}:${_APP_REDIS_PORT}" php /usr/src/code/vendor/bin/resque -dopcache.preload=opcache.preload=/usr/src/code/app/preload.php
|
|
@ -1,3 +1,3 @@
|
||||||
#!/bin/bash
|
#!/bin/sh
|
||||||
|
|
||||||
QUEUE='v1-certificates' APP_INCLUDE='/usr/src/code/app/workers/certificates.php' REDIS_BACKEND="${_APP_REDIS_HOST}:${_APP_REDIS_PORT}" php /usr/src/code/vendor/bin/resque -dopcache.preload=opcache.preload=/usr/src/code/app/preload.php
|
QUEUE='v1-certificates' APP_INCLUDE='/usr/src/code/app/workers/certificates.php' REDIS_BACKEND="${_APP_REDIS_HOST}:${_APP_REDIS_PORT}" php /usr/src/code/vendor/bin/resque -dopcache.preload=opcache.preload=/usr/src/code/app/preload.php
|
|
@ -1,3 +1,3 @@
|
||||||
#!/bin/bash
|
#!/bin/sh
|
||||||
|
|
||||||
QUEUE='v1-deletes' APP_INCLUDE='/usr/src/code/app/workers/deletes.php' REDIS_BACKEND="${_APP_REDIS_HOST}:${_APP_REDIS_PORT}" php /usr/src/code/vendor/bin/resque -dopcache.preload=opcache.preload=/usr/src/code/app/preload.php
|
QUEUE='v1-deletes' APP_INCLUDE='/usr/src/code/app/workers/deletes.php' REDIS_BACKEND="${_APP_REDIS_HOST}:${_APP_REDIS_PORT}" php /usr/src/code/vendor/bin/resque -dopcache.preload=opcache.preload=/usr/src/code/app/preload.php
|
|
@ -1,3 +1,3 @@
|
||||||
#!/bin/bash
|
#!/bin/sh
|
||||||
|
|
||||||
QUEUE='v1-functions' APP_INCLUDE='/usr/src/code/app/workers/functions.php' REDIS_BACKEND="${_APP_REDIS_HOST}:${_APP_REDIS_PORT}" php /usr/src/code/vendor/bin/resque -dopcache.preload=opcache.preload=/usr/src/code/app/preload.php
|
QUEUE='v1-functions' APP_INCLUDE='/usr/src/code/app/workers/functions.php' REDIS_BACKEND="${_APP_REDIS_HOST}:${_APP_REDIS_PORT}" php /usr/src/code/vendor/bin/resque -dopcache.preload=opcache.preload=/usr/src/code/app/preload.php
|
|
@ -1,3 +1,3 @@
|
||||||
#!/bin/bash
|
#!/bin/sh
|
||||||
|
|
||||||
QUEUE='v1-mails' APP_INCLUDE='/usr/src/code/app/workers/mails.php' REDIS_BACKEND="${_APP_REDIS_HOST}:${_APP_REDIS_PORT}" php /usr/src/code/vendor/bin/resque -dopcache.preload=opcache.preload=/usr/src/code/app/preload.php
|
QUEUE='v1-mails' APP_INCLUDE='/usr/src/code/app/workers/mails.php' REDIS_BACKEND="${_APP_REDIS_HOST}:${_APP_REDIS_PORT}" php /usr/src/code/vendor/bin/resque -dopcache.preload=opcache.preload=/usr/src/code/app/preload.php
|
|
@ -1,3 +1,3 @@
|
||||||
#!/bin/bash
|
#!/bin/sh
|
||||||
|
|
||||||
QUEUE='v1-tasks' APP_INCLUDE='/usr/src/code/app/workers/tasks.php' REDIS_BACKEND="${_APP_REDIS_HOST}:${_APP_REDIS_PORT}" php /usr/src/code/vendor/bin/resque -dopcache.preload=opcache.preload=/usr/src/code/app/preload.php
|
QUEUE='v1-tasks' APP_INCLUDE='/usr/src/code/app/workers/tasks.php' REDIS_BACKEND="${_APP_REDIS_HOST}:${_APP_REDIS_PORT}" php /usr/src/code/vendor/bin/resque -dopcache.preload=opcache.preload=/usr/src/code/app/preload.php
|
|
@ -1,3 +1,3 @@
|
||||||
#!/bin/bash
|
#!/bin/sh
|
||||||
|
|
||||||
QUEUE='v1-usage' APP_INCLUDE='/usr/src/code/app/workers/usage.php' REDIS_BACKEND="${_APP_REDIS_HOST}:${_APP_REDIS_PORT}" php /usr/src/code/vendor/bin/resque -dopcache.preload=opcache.preload=/usr/src/code/app/preload.php
|
QUEUE='v1-usage' APP_INCLUDE='/usr/src/code/app/workers/usage.php' REDIS_BACKEND="${_APP_REDIS_HOST}:${_APP_REDIS_PORT}" php /usr/src/code/vendor/bin/resque -dopcache.preload=opcache.preload=/usr/src/code/app/preload.php
|
|
@ -1,3 +1,3 @@
|
||||||
#!/bin/bash
|
#!/bin/sh
|
||||||
|
|
||||||
QUEUE='v1-webhooks' APP_INCLUDE='/usr/src/code/app/workers/webhooks.php' REDIS_BACKEND="${_APP_REDIS_HOST}:${_APP_REDIS_PORT}" php /usr/src/code/vendor/bin/resque -dopcache.preload=opcache.preload=/usr/src/code/app/preload.php
|
QUEUE='v1-webhooks' APP_INCLUDE='/usr/src/code/app/workers/webhooks.php' REDIS_BACKEND="${_APP_REDIS_HOST}:${_APP_REDIS_PORT}" php /usr/src/code/vendor/bin/resque -dopcache.preload=opcache.preload=/usr/src/code/app/preload.php
|
Loading…
Reference in a new issue