1
0
Fork 0
mirror of synced 2024-06-01 18:39:57 +12:00
appwrite/Dockerfile

206 lines
7.3 KiB
Docker
Raw Normal View History

FROM composer:2.0 as composer
2019-10-06 13:09:19 +13:00
ARG TESTING=false
2020-06-26 21:54:37 +12: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 21:54:37 +12:00
--no-plugins --no-scripts --prefer-dist \
`if [ "$TESTING" != "true" ]; then echo "--no-dev"; fi`
2023-04-20 00:03:23 +12:00
FROM --platform=$BUILDPLATFORM node:16.14.2-alpine3.15 as node
2021-10-22 06:20:41 +13:00
2022-10-27 08:23:02 +13:00
COPY app/console /usr/local/src/console
2021-10-22 06:20:41 +13:00
2022-10-27 08:23:02 +13:00
WORKDIR /usr/local/src/console
2021-10-22 06:20:41 +13:00
ARG VITE_GA_PROJECT
2022-11-23 08:32:35 +13:00
ARG VITE_CONSOLE_MODE
2023-03-10 20:42:52 +13:00
ARG VITE_APPWRITE_GROWTH_ENDPOINT=https://growth.appwrite.io/v1
2022-11-23 08:32:35 +13:00
2022-11-23 07:26:41 +13:00
ENV VITE_GA_PROJECT=$VITE_GA_PROJECT
2022-11-23 08:32:35 +13:00
ENV VITE_CONSOLE_MODE=$VITE_CONSOLE_MODE
2023-03-10 20:42:52 +13:00
ENV VITE_APPWRITE_GROWTH_ENDPOINT=$VITE_APPWRITE_GROWTH_ENDPOINT
2022-11-23 07:26:41 +13:00
2021-10-22 06:20:41 +13:00
RUN npm ci
RUN npm run build
2023-08-06 22:30:38 +12:00
FROM appwrite/base:0.4.3 as final
2019-11-29 20:34:13 +13:00
2019-08-01 07:39:31 +12:00
LABEL maintainer="team@appwrite.io"
2019-05-09 18:54:39 +12:00
2019-11-29 20:34:13 +13:00
ARG VERSION=dev
2021-07-12 00:25:39 +12:00
ARG DEBUG=false
ENV DEBUG=$DEBUG
2019-11-29 20:34:13 +13:00
2022-06-09 23:38:38 +12:00
ENV DOCKER_CONFIG=${DOCKER_CONFIG:-$HOME/.docker}
2022-06-10 23:37:39 +12:00
ENV DOCKER_COMPOSE_VERSION=v2.5.0
2019-11-29 20:34:13 +13:00
2020-10-28 06:24:18 +13:00
ENV _APP_SERVER=swoole \
2019-10-06 13:09:19 +13:00
_APP_ENV=production \
_APP_LOCALE=en \
2023-03-10 20:42:52 +13:00
_APP_WORKER_PER_CORE= \
2020-03-01 19:33:19 +13:00
_APP_DOMAIN=localhost \
2023-07-31 18:47:47 +12:00
_APP_DOMAIN_FUNCTIONS=functions.localhost \
2020-03-01 19:33:19 +13:00
_APP_DOMAIN_TARGET=localhost \
2019-10-06 13:09:19 +13:00
_APP_HOME=https://appwrite.io \
_APP_EDITION=community \
2021-05-13 02:53:25 +12:00
_APP_CONSOLE_WHITELIST_ROOT=enabled \
2023-03-10 20:42:52 +13:00
_APP_CONSOLE_WHITELIST_EMAILS= \
_APP_CONSOLE_WHITELIST_IPS= \
2023-07-21 22:23:08 +12:00
_APP_CONSOLE_ROOT_SESSION= \
2023-03-10 20:42:52 +13:00
_APP_SYSTEM_EMAIL_NAME= \
_APP_SYSTEM_EMAIL_ADDRESS= \
_APP_SYSTEM_RESPONSE_FORMAT= \
_APP_SYSTEM_SECURITY_EMAIL_ADDRESS= \
2019-10-06 13:09:19 +13:00
_APP_OPTIONS_ABUSE=enabled \
2020-06-02 07:58:58 +12:00
_APP_OPTIONS_FORCE_HTTPS=disabled \
2019-10-06 13:09:19 +13:00
_APP_OPENSSL_KEY_V1=your-secret-key \
2020-10-28 08:56:37 +13:00
_APP_STORAGE_LIMIT=10000000 \
_APP_STORAGE_ANTIVIRUS=enabled \
2021-01-03 08:45:59 +13:00
_APP_STORAGE_ANTIVIRUS_HOST=clamav \
_APP_STORAGE_ANTIVIRUS_PORT=3310 \
2023-03-10 20:42:52 +13:00
_APP_STORAGE_DEVICE=Local \
_APP_STORAGE_S3_ACCESS_KEY= \
_APP_STORAGE_S3_SECRET= \
_APP_STORAGE_S3_REGION= \
_APP_STORAGE_S3_BUCKET= \
_APP_STORAGE_DO_SPACES_ACCESS_KEY= \
_APP_STORAGE_DO_SPACES_SECRET= \
_APP_STORAGE_DO_SPACES_REGION= \
_APP_STORAGE_DO_SPACES_BUCKET= \
_APP_STORAGE_BACKBLAZE_ACCESS_KEY= \
_APP_STORAGE_BACKBLAZE_SECRET= \
_APP_STORAGE_BACKBLAZE_REGION= \
_APP_STORAGE_BACKBLAZE_BUCKET= \
_APP_STORAGE_LINODE_ACCESS_KEY= \
_APP_STORAGE_LINODE_SECRET= \
_APP_STORAGE_LINODE_REGION= \
_APP_STORAGE_LINODE_BUCKET= \
_APP_STORAGE_WASABI_ACCESS_KEY= \
_APP_STORAGE_WASABI_SECRET= \
_APP_STORAGE_WASABI_REGION= \
_APP_STORAGE_WASABI_BUCKET= \
2019-10-06 13:09:19 +13: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 \
2023-08-21 00:29:43 +12:00
_APP_INFLUXDB_HOST=influxdb \
_APP_INFLUXDB_PORT=8086 \
_APP_STATSD_HOST=telegraf \
_APP_STATSD_PORT=8125 \
2022-02-23 21:04:44 +13:00
_APP_FUNCTIONS_SIZE_LIMIT=30000000 \
2020-07-20 02:42:46 +12:00
_APP_FUNCTIONS_TIMEOUT=900 \
2023-03-10 20:42:52 +13:00
_APP_FUNCTIONS_CONTAINERS=10 \
2020-12-15 07:04:57 +13:00
_APP_FUNCTIONS_CPUS=1 \
_APP_FUNCTIONS_MEMORY=128 \
2023-03-10 20:42:52 +13:00
_APP_FUNCTIONS_MEMORY_SWAP=128 \
2021-09-22 22:08:02 +12:00
_APP_EXECUTOR_SECRET=a-random-secret \
2023-03-10 20:42:52 +13:00
_APP_EXECUTOR_HOST=http://appwrite-executor/v1 \
_APP_EXECUTOR_RUNTIME_NETWORK=appwrite_runtimes \
2020-02-04 21:06:13 +13:00
_APP_SETUP=self-hosted \
2020-12-15 05:39:44 +13:00
_APP_VERSION=$VERSION \
_APP_USAGE_STATS=enabled \
2023-03-10 20:42:52 +13:00
_APP_USAGE_AGGREGATION_INTERVAL=30 \
# 14 Days = 1209600 s
2021-01-21 07:23:48 +13:00
_APP_MAINTENANCE_RETENTION_EXECUTION=1209600 \
_APP_MAINTENANCE_RETENTION_AUDIT=1209600 \
2020-12-23 01:57:22 +13:00
# 1 Day = 86400 s
2021-01-21 07:23:48 +13:00
_APP_MAINTENANCE_RETENTION_ABUSE=86400 \
2022-10-28 22:54:56 +13:00
_APP_MAINTENANCE_RETENTION_USAGE_HOURLY=8640000 \
2023-03-10 20:42:52 +13:00
_APP_MAINTENANCE_INTERVAL=86400 \
_APP_LOGGING_PROVIDER= \
2023-07-31 18:47:47 +12:00
_APP_LOGGING_CONFIG= \
_APP_VCS_GITHUB_APP_NAME= \
_APP_VCS_GITHUB_PRIVATE_KEY= \
_APP_VCS_GITHUB_APP_ID= \
_APP_VCS_GITHUB_CLIENT_ID= \
_APP_VCS_GITHUB_CLIENT_SECRET= \
_APP_VCS_GITHUB_WEBHOOK_SECRET=
2022-06-09 23:38:38 +12:00
RUN \
2021-07-12 00:25:39 +12:00
if [ "$DEBUG" == "true" ]; then \
apk add boost boost-dev; \
fi
2020-06-26 21:54:37 +12:00
WORKDIR /usr/src/code
COPY --from=composer /usr/local/src/vendor /usr/src/code/vendor
2022-10-27 08:23:02 +13:00
COPY --from=node /usr/local/src/console/build /usr/src/code/console
2020-06-26 21:54:37 +12:00
# Add Source Code
COPY ./app /usr/src/code/app
COPY ./public /usr/src/code/public
2020-05-21 19:00:06 +12:00
COPY ./bin /usr/local/bin
2020-06-26 21:54:37 +12:00
COPY ./docs /usr/src/code/docs
COPY ./src /usr/src/code/src
2019-05-09 18:54:39 +12:00
2020-06-26 21:54:37 +12:00
# Set Volumes
2019-10-06 13:09:19 +13:00
RUN mkdir -p /storage/uploads && \
mkdir -p /storage/cache && \
2020-05-01 22:24:36 +12:00
mkdir -p /storage/config && \
mkdir -p /storage/certificates && \
2020-07-15 09:20:46 +12:00
mkdir -p /storage/functions && \
2020-07-05 06:21:07 +12:00
mkdir -p /storage/debug && \
2019-10-06 13:09:19 +13:00
chown -Rf www-data.www-data /storage/uploads && chmod -Rf 0755 /storage/uploads && \
2020-05-01 22:24:36 +12: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-05 06:21:07 +12:00
chown -Rf www-data.www-data /storage/certificates && chmod -Rf 0755 /storage/certificates && \
2020-07-15 09:20:46 +12:00
chown -Rf www-data.www-data /storage/functions && chmod -Rf 0755 /storage/functions && \
2020-07-05 06:21:07 +12:00
chown -Rf www-data.www-data /storage/debug && chmod -Rf 0755 /storage/debug
2019-09-28 02:29:19 +12:00
2020-05-21 19:00:06 +12:00
# Executables
2020-07-21 10:59:44 +12:00
RUN chmod +x /usr/local/bin/doctor && \
2023-03-23 08:15:01 +13:00
chmod +x /usr/local/bin/patch-delete-schedule-updated-at-attribute && \
2023-05-02 23:21:08 +12:00
chmod +x /usr/local/bin/clear-card-cache && \
2023-05-24 21:17:14 +12:00
chmod +x /usr/local/bin/calc-users-stats && \
2023-05-31 03:06:51 +12:00
chmod +x /usr/local/bin/calc-tier-stats && \
chmod +x /usr/local/bin/patch-delete-project-collections && \
2023-05-31 03:17:47 +12:00
chmod +x /usr/local/bin/maintenance && \
chmod +x /usr/local/bin/volume-sync && \
2023-08-21 00:29:43 +12:00
chmod +x /usr/local/bin/usage && \
2020-07-29 07:48:51 +12:00
chmod +x /usr/local/bin/install && \
2020-07-21 10:59:44 +12:00
chmod +x /usr/local/bin/migrate && \
2020-10-16 20:31:09 +13:00
chmod +x /usr/local/bin/realtime && \
2020-07-21 10:59:44 +12:00
chmod +x /usr/local/bin/schedule && \
2020-10-29 23:58:48 +13:00
chmod +x /usr/local/bin/sdks && \
chmod +x /usr/local/bin/specs && \
2020-07-29 07:48:51 +12:00
chmod +x /usr/local/bin/ssl && \
2023-01-26 09:56:33 +13:00
chmod +x /usr/local/bin/hamster && \
2020-07-21 10:59:44 +12:00
chmod +x /usr/local/bin/test && \
2020-10-15 18:03:38 +13:00
chmod +x /usr/local/bin/vars && \
2020-07-21 10:59:44 +12: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 22:51:49 +12:00
chmod +x /usr/local/bin/worker-databases && \
2020-07-21 10:59:44 +12:00
chmod +x /usr/local/bin/worker-deletes && \
chmod +x /usr/local/bin/worker-functions && \
2022-01-24 11:25:46 +13:00
chmod +x /usr/local/bin/worker-builds && \
2020-07-21 10:59:44 +12:00
chmod +x /usr/local/bin/worker-mails && \
2022-06-09 01:57:34 +12:00
chmod +x /usr/local/bin/worker-messaging && \
2022-12-05 06:06:23 +13:00
chmod +x /usr/local/bin/worker-webhooks && \
2023-08-21 00:29:43 +12:00
chmod +x /usr/local/bin/worker-migrations
2019-05-09 18:54:39 +12:00
2020-02-25 05:47:45 +13:00
# Letsencrypt Permissions
2020-02-25 21:42:14 +13:00
RUN mkdir -p /etc/letsencrypt/live/ && chmod -Rf 755 /etc/letsencrypt/live/
2020-02-25 05:47:45 +13:00
2020-06-26 21:54:37 +12:00
# Enable Extensions
RUN if [ "$DEBUG" == "true" ]; then printf "zend_extension=yasd \nyasd.debug_mode=remote \nyasd.init_file=/usr/src/code/dev/yasd_init.php \nyasd.remote_port=9005 \nyasd.log_level=-1" >> /usr/local/etc/php/conf.d/yasd.ini; fi
2020-07-05 06:21:07 +12:00
2021-07-12 00:25:39 +12:00
RUN if [ "$DEBUG" == "true" ]; then echo "opcache.enable=0" >> /usr/local/etc/php/conf.d/appwrite.ini; fi
2020-07-05 06:21:07 +12: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-28 08:56:37 +13: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 19:20:52 +13: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 21:54:37 +12:00
2020-07-03 00:24:39 +12:00
EXPOSE 80
2020-06-26 21:54:37 +12:00
2022-11-10 03:45:20 +13:00
CMD [ "php", "app/http.php", "-dopcache.preload=opcache.preload=/usr/src/code/app/preload.php" ]