appwrite/Dockerfile

159 lines
5.5 KiB
Text
Raw Normal View History

FROM composer:2.0 as composer
2019-10-06 00:09:19 +00:00
ARG TESTING=false
2020-06-26 09:54:37 +00:00
ENV TESTING=$TESTING
WORKDIR /usr/local/src/
COPY composer.lock /usr/local/src/
COPY composer.json /usr/local/src/
RUN composer install --ignore-platform-reqs --optimize-autoloader \
2020-06-26 09:54:37 +00:00
--no-plugins --no-scripts --prefer-dist \
`if [ "$TESTING" != "true" ]; then echo "--no-dev"; fi`
2022-04-20 14:55:37 +00:00
FROM node:16.14.2-alpine3.15 as node
2021-10-21 17:20:41 +00:00
2022-10-26 19:23:02 +00:00
COPY app/console /usr/local/src/console
2021-10-21 17:20:41 +00:00
2022-10-26 19:23:02 +00:00
WORKDIR /usr/local/src/console
2021-10-21 17:20:41 +00:00
ARG VITE_GA_PROJECT
2022-11-22 19:32:35 +00:00
ARG VITE_CONSOLE_MODE
2023-02-13 23:29:35 +00:00
ARG VITE_APPWRITE_GROWTH_ENDPOINT=https://growth.appwrite.io/v1
2022-11-22 19:32:35 +00:00
2022-11-22 18:26:41 +00:00
ENV VITE_GA_PROJECT=$VITE_GA_PROJECT
2022-11-22 19:32:35 +00:00
ENV VITE_CONSOLE_MODE=$VITE_CONSOLE_MODE
2023-01-19 16:08:05 +00:00
ENV VITE_APPWRITE_GROWTH_ENDPOINT=$VITE_APPWRITE_GROWTH_ENDPOINT
2022-11-22 18:26:41 +00:00
2021-10-21 17:20:41 +00:00
RUN npm ci
RUN npm run build
2023-03-24 13:33:25 +00:00
FROM appwrite/base:0.2.2 as final
2019-11-29 07:34:13 +00:00
2019-07-31 19:39:31 +00:00
LABEL maintainer="team@appwrite.io"
2019-05-09 06:54:39 +00:00
2019-11-29 07:34:13 +00:00
ARG VERSION=dev
2021-07-11 12:25:39 +00:00
ARG DEBUG=false
ENV DEBUG=$DEBUG
2019-11-29 07:34:13 +00:00
2022-06-09 11:38:38 +00:00
ENV DOCKER_CONFIG=${DOCKER_CONFIG:-$HOME/.docker}
2022-06-10 11:37:39 +00:00
ENV DOCKER_COMPOSE_VERSION=v2.5.0
2019-11-29 07:34:13 +00:00
2020-10-27 17:24:18 +00:00
ENV _APP_SERVER=swoole \
2019-10-06 00:09:19 +00:00
_APP_ENV=production \
_APP_LOCALE=en \
2020-03-01 06:33:19 +00:00
_APP_DOMAIN=localhost \
_APP_DOMAIN_TARGET=localhost \
2019-10-06 00:09:19 +00:00
_APP_HOME=https://appwrite.io \
_APP_EDITION=community \
2021-05-12 14:53:25 +00:00
_APP_CONSOLE_WHITELIST_ROOT=enabled \
2019-10-06 00:09:19 +00:00
_APP_OPTIONS_ABUSE=enabled \
2020-06-01 19:58:58 +00:00
_APP_OPTIONS_FORCE_HTTPS=disabled \
2019-10-06 00:09:19 +00:00
_APP_OPENSSL_KEY_V1=your-secret-key \
2020-10-27 19:56:37 +00:00
_APP_STORAGE_LIMIT=10000000 \
_APP_STORAGE_ANTIVIRUS=enabled \
2021-01-02 19:45:59 +00:00
_APP_STORAGE_ANTIVIRUS_HOST=clamav \
_APP_STORAGE_ANTIVIRUS_PORT=3310 \
2019-10-06 00:09:19 +00:00
_APP_REDIS_HOST=redis \
_APP_REDIS_PORT=6379 \
_APP_DB_HOST=mariadb \
_APP_DB_PORT=3306 \
_APP_DB_USER=root \
_APP_DB_PASS=password \
_APP_DB_SCHEMA=appwrite \
_APP_INFLUXDB_HOST=influxdb \
_APP_INFLUXDB_PORT=8086 \
_APP_STATSD_HOST=telegraf \
_APP_STATSD_PORT=8125 \
2022-02-23 08:04:44 +00:00
_APP_FUNCTIONS_SIZE_LIMIT=30000000 \
2020-07-19 14:42:46 +00:00
_APP_FUNCTIONS_TIMEOUT=900 \
2020-12-14 18:04:57 +00:00
_APP_FUNCTIONS_CPUS=1 \
_APP_FUNCTIONS_MEMORY=128 \
2021-09-22 10:08:02 +00:00
_APP_EXECUTOR_SECRET=a-random-secret \
2022-11-10 09:37:49 +00:00
_APP_EXECUTOR_HOST=http://exc1/v1 \
2020-02-04 08:06:13 +00:00
_APP_SETUP=self-hosted \
2020-12-14 16:39:44 +00:00
_APP_VERSION=$VERSION \
_APP_USAGE_STATS=enabled \
# 14 Days = 1209600 s
2021-01-20 18:23:48 +00:00
_APP_MAINTENANCE_RETENTION_EXECUTION=1209600 \
_APP_MAINTENANCE_RETENTION_AUDIT=1209600 \
2020-12-22 12:57:22 +00:00
# 1 Day = 86400 s
2021-01-20 18:23:48 +00:00
_APP_MAINTENANCE_RETENTION_ABUSE=86400 \
2022-10-28 09:54:56 +00:00
_APP_MAINTENANCE_RETENTION_USAGE_HOURLY=8640000 \
2022-11-18 08:15:11 +00:00
_APP_MAINTENANCE_INTERVAL=86400
2019-08-10 11:38:09 +00:00
2022-06-09 11:38:38 +00:00
RUN \
2021-07-11 12:25:39 +00:00
if [ "$DEBUG" == "true" ]; then \
apk add boost boost-dev; \
fi
2020-06-26 09:54:37 +00:00
WORKDIR /usr/src/code
COPY --from=composer /usr/local/src/vendor /usr/src/code/vendor
2022-10-26 19:23:02 +00:00
COPY --from=node /usr/local/src/console/build /usr/src/code/console
2020-06-26 09:54:37 +00:00
# Add Source Code
COPY ./app /usr/src/code/app
2020-05-21 07:00:06 +00:00
COPY ./bin /usr/local/bin
2020-06-26 09:54:37 +00:00
COPY ./docs /usr/src/code/docs
COPY ./src /usr/src/code/src
2019-05-09 06:54:39 +00:00
2020-06-26 09:54:37 +00:00
# Set Volumes
2019-10-06 00:09:19 +00:00
RUN mkdir -p /storage/uploads && \
mkdir -p /storage/cache && \
2020-05-01 10:24:36 +00:00
mkdir -p /storage/config && \
mkdir -p /storage/certificates && \
2020-07-14 21:20:46 +00:00
mkdir -p /storage/functions && \
2020-07-04 18:21:07 +00:00
mkdir -p /storage/debug && \
2019-10-06 00:09:19 +00:00
chown -Rf www-data.www-data /storage/uploads && chmod -Rf 0755 /storage/uploads && \
2020-05-01 10:24:36 +00:00
chown -Rf www-data.www-data /storage/cache && chmod -Rf 0755 /storage/cache && \
chown -Rf www-data.www-data /storage/config && chmod -Rf 0755 /storage/config && \
2020-07-04 18:21:07 +00:00
chown -Rf www-data.www-data /storage/certificates && chmod -Rf 0755 /storage/certificates && \
2020-07-14 21:20:46 +00:00
chown -Rf www-data.www-data /storage/functions && chmod -Rf 0755 /storage/functions && \
2020-07-04 18:21:07 +00:00
chown -Rf www-data.www-data /storage/debug && chmod -Rf 0755 /storage/debug
2019-09-27 14:29:19 +00:00
2020-05-21 07:00:06 +00:00
# Executables
2020-07-20 22:59:44 +00:00
RUN chmod +x /usr/local/bin/doctor && \
2023-03-22 19:15:01 +00:00
chmod +x /usr/local/bin/patch-delete-schedule-updated-at-attribute && \
2020-12-14 16:39:44 +00:00
chmod +x /usr/local/bin/maintenance && \
chmod +x /usr/local/bin/volume-sync && \
2021-08-11 05:44:08 +00:00
chmod +x /usr/local/bin/usage && \
2020-07-28 19:48:51 +00:00
chmod +x /usr/local/bin/install && \
2020-07-20 22:59:44 +00:00
chmod +x /usr/local/bin/migrate && \
2020-10-16 07:31:09 +00:00
chmod +x /usr/local/bin/realtime && \
2020-07-20 22:59:44 +00:00
chmod +x /usr/local/bin/schedule && \
2020-10-29 10:58:48 +00:00
chmod +x /usr/local/bin/sdks && \
chmod +x /usr/local/bin/specs && \
2020-07-28 19:48:51 +00:00
chmod +x /usr/local/bin/ssl && \
2023-01-25 20:56:33 +00:00
chmod +x /usr/local/bin/hamster && \
2020-07-20 22:59:44 +00:00
chmod +x /usr/local/bin/test && \
2020-10-15 05:03:38 +00:00
chmod +x /usr/local/bin/vars && \
2020-07-20 22:59:44 +00:00
chmod +x /usr/local/bin/worker-audits && \
chmod +x /usr/local/bin/worker-certificates && \
Database layer (#3338) * database response model * database collection config * new database scopes * database service update * database execption codes * remove read write permission from database model * updating tests and fixing some bugs * server side tests are now passing * databases api * tests for database endpoint * composer update * fix error * formatting * formatting fixes * get database test * more updates to events and usage * more usage updates * fix delete type * fix test * delete database * more fixes * databaseId in attributes and indexes * more fixes * fix issues * fix index subquery * fix console scope and index query * updating tests as required * fix phpcs errors and warnings * updates to review suggestions * UI progress * ui updates and cleaning up * fix type * rework database events * update tests * update types * event generation fixed * events config updated * updating context to support multiple * realtime updates * fix ids * update context * validator updates * fix naming conflict * fix tests * fix lint errors * fix wprler and realtime tests * fix webhooks test * fix event validator and other tests * formatting fixes * removing leftover var_dumps * remove leftover comment * update usage params * usage metrics updates * update database usage * fix usage * specs update * updates to usage * fix UI and usage * fix lints * internal id fixes * fixes for internal Id * renaming services and related files * rename tests * rename doc link * rename readme * fix test name * tests: fixes for 0.15.x sync Co-authored-by: Torsten Dittmann <torsten.dittmann@googlemail.com>
2022-06-22 10:51:49 +00:00
chmod +x /usr/local/bin/worker-databases && \
2020-07-20 22:59:44 +00:00
chmod +x /usr/local/bin/worker-deletes && \
chmod +x /usr/local/bin/worker-functions && \
2022-01-23 22:25:46 +00:00
chmod +x /usr/local/bin/worker-builds && \
2020-07-20 22:59:44 +00:00
chmod +x /usr/local/bin/worker-mails && \
2022-06-08 13:57:34 +00:00
chmod +x /usr/local/bin/worker-messaging && \
chmod +x /usr/local/bin/worker-webhooks
2019-05-09 06:54:39 +00:00
2020-02-24 16:47:45 +00:00
# Letsencrypt Permissions
2020-02-25 08:42:14 +00:00
RUN mkdir -p /etc/letsencrypt/live/ && chmod -Rf 755 /etc/letsencrypt/live/
2020-02-24 16:47:45 +00:00
2020-06-26 09:54:37 +00:00
# Enable Extensions
2021-07-11 12:25:39 +00:00
RUN if [ "$DEBUG" == "true" ]; then printf "zend_extension=yasd \nyasd.debug_mode=remote \nyasd.init_file=/usr/local/dev/yasd_init.php \nyasd.remote_port=9005 \nyasd.log_level=-1" >> /usr/local/etc/php/conf.d/yasd.ini; fi
2020-07-04 18:21:07 +00:00
2021-07-11 12:25:39 +00:00
RUN if [ "$DEBUG" == "true" ]; then echo "opcache.enable=0" >> /usr/local/etc/php/conf.d/appwrite.ini; fi
2020-07-04 18:21:07 +00:00
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
2020-10-27 19:56:37 +00:00
RUN echo "opcache.enable_cli=1" >> /usr/local/etc/php/conf.d/appwrite.ini
RUN echo "default_socket_timeout=-1" >> /usr/local/etc/php/conf.d/appwrite.ini
2020-10-27 06:20:52 +00:00
RUN echo "opcache.jit_buffer_size=100M" >> /usr/local/etc/php/conf.d/appwrite.ini
RUN echo "opcache.jit=1235" >> /usr/local/etc/php/conf.d/appwrite.ini
2020-06-26 09:54:37 +00:00
2020-07-02 12:24:39 +00:00
EXPOSE 80
2020-06-26 09:54:37 +00:00
2022-11-09 14:45:20 +00:00
CMD [ "php", "app/http.php", "-dopcache.preload=opcache.preload=/usr/src/code/app/preload.php" ]