Skip to content

Commit 46f07fa

Browse files
committed
feat: update Docekrfile to use appwrite:base image
1 parent a492ad5 commit 46f07fa

File tree

4 files changed

+23
-219
lines changed

4 files changed

+23
-219
lines changed

.gitmodules

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
[submodule "app/console"]
22
path = app/console
33
url = https://github.com/appwrite/console
4-
branch = main
4+
branch = 2.2.2

Dockerfile

Lines changed: 1 addition & 197 deletions
Original file line numberDiff line numberDiff line change
@@ -29,155 +29,7 @@ ENV VITE_APPWRITE_GROWTH_ENDPOINT=$VITE_APPWRITE_GROWTH_ENDPOINT
2929
RUN npm ci
3030
RUN npm run build
3131

32-
FROM php:8.0.18-cli-alpine3.15 as compile
33-
34-
ARG DEBUG=false
35-
ENV DEBUG=$DEBUG
36-
37-
ENV PHP_REDIS_VERSION=5.3.7 \
38-
PHP_MONGODB_VERSION=1.13.0 \
39-
PHP_SWOOLE_VERSION=v4.8.10 \
40-
PHP_IMAGICK_VERSION=3.7.0 \
41-
PHP_YAML_VERSION=2.2.2 \
42-
PHP_MAXMINDDB_VERSION=v1.11.0 \
43-
PHP_MEMCACHED_VERSION=v3.2.0 \
44-
PHP_ZSTD_VERSION="4504e4186e79b197cfcb75d4d09aa47ef7d92fe9 "
45-
46-
RUN \
47-
apk add --no-cache --virtual .deps \
48-
make \
49-
automake \
50-
autoconf \
51-
gcc \
52-
g++ \
53-
git \
54-
zlib-dev \
55-
brotli-dev \
56-
openssl-dev \
57-
yaml-dev \
58-
imagemagick \
59-
imagemagick-dev \
60-
libmaxminddb-dev \
61-
libmemcached-dev \
62-
zstd-dev
63-
64-
RUN docker-php-ext-install sockets
65-
66-
FROM compile AS redis
67-
RUN \
68-
# Redis Extension
69-
git clone --depth 1 --branch $PHP_REDIS_VERSION https://github.com/phpredis/phpredis.git && \
70-
cd phpredis && \
71-
phpize && \
72-
./configure && \
73-
make && make install
74-
75-
## Swoole Extension
76-
FROM compile AS swoole
77-
RUN \
78-
git clone --depth 1 --branch $PHP_SWOOLE_VERSION https://github.com/swoole/swoole-src.git && \
79-
cd swoole-src && \
80-
phpize && \
81-
./configure --enable-sockets --enable-http2 --enable-openssl && \
82-
make && make install && \
83-
cd ..
84-
85-
## Swoole Debugger setup
86-
RUN if [ "$DEBUG" == "true" ]; then \
87-
cd /tmp && \
88-
apk add boost-dev && \
89-
git clone --depth 1 https://github.com/swoole/yasd && \
90-
cd yasd && \
91-
phpize && \
92-
./configure && \
93-
make && make install && \
94-
cd ..;\
95-
fi
96-
97-
## Imagick Extension
98-
FROM compile AS imagick
99-
RUN \
100-
git clone --depth 1 --branch $PHP_IMAGICK_VERSION https://github.com/imagick/imagick && \
101-
cd imagick && \
102-
phpize && \
103-
./configure && \
104-
make && make install
105-
106-
## YAML Extension
107-
FROM compile AS yaml
108-
RUN \
109-
git clone --depth 1 --branch $PHP_YAML_VERSION https://github.com/php/pecl-file_formats-yaml && \
110-
cd pecl-file_formats-yaml && \
111-
phpize && \
112-
./configure && \
113-
make && make install
114-
115-
## Maxminddb extension
116-
FROM compile AS maxmind
117-
RUN \
118-
git clone --depth 1 --branch $PHP_MAXMINDDB_VERSION https://github.com/maxmind/MaxMind-DB-Reader-php.git && \
119-
cd MaxMind-DB-Reader-php && \
120-
cd ext && \
121-
phpize && \
122-
./configure && \
123-
make && make install
124-
125-
# Mongodb Extension
126-
FROM compile as mongodb
127-
RUN \
128-
git clone --depth 1 --branch $PHP_MONGODB_VERSION https://github.com/mongodb/mongo-php-driver.git && \
129-
cd mongo-php-driver && \
130-
git submodule update --init && \
131-
phpize && \
132-
./configure && \
133-
make && make install
134-
135-
# Memcached Extension
136-
FROM compile as memcached
137-
RUN \
138-
git clone --depth 1 --branch $PHP_MEMCACHED_VERSION https://github.com/php-memcached-dev/php-memcached.git && \
139-
cd php-memcached && \
140-
phpize && \
141-
./configure && \
142-
make && make install
143-
144-
# Zstd Compression
145-
FROM compile as zstd
146-
RUN git clone --recursive -n https://github.com/kjdev/php-ext-zstd.git \
147-
&& cd php-ext-zstd \
148-
&& git checkout $PHP_ZSTD_VERSION \
149-
&& phpize \
150-
&& ./configure --with-libzstd \
151-
&& make && make install
152-
153-
# Rust Extensions Compile Image
154-
FROM php:8.0.18-cli as rust_compile
155-
156-
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
157-
158-
ENV PATH=/root/.cargo/bin:$PATH
159-
160-
RUN apt-get update && apt-get install musl-tools build-essential clang-11 git -y
161-
RUN rustup target add $(uname -m)-unknown-linux-musl
162-
163-
# Install ZigBuild for easier cross-compilation
164-
RUN curl https://ziglang.org/builds/zig-linux-$(uname -m)-0.10.0-dev.2674+d980c6a38.tar.xz --output /tmp/zig.tar.xz
165-
RUN tar -xf /tmp/zig.tar.xz -C /tmp/ && cp -r /tmp/zig-linux-$(uname -m)-0.10.0-dev.2674+d980c6a38 /tmp/zig/
166-
ENV PATH=/tmp/zig:$PATH
167-
RUN cargo install cargo-zigbuild
168-
ENV RUSTFLAGS="-C target-feature=-crt-static"
169-
170-
FROM rust_compile as scrypt
171-
172-
WORKDIR /usr/local/lib/php/extensions/
173-
174-
RUN \
175-
git clone --depth 1 https://github.com/appwrite/php-scrypt.git && \
176-
cd php-scrypt && \
177-
cargo zigbuild --workspace --all-targets --target $(uname -m)-unknown-linux-musl --release && \
178-
mv target/$(uname -m)-unknown-linux-musl/release/libphp_scrypt.so target/libphp_scrypt.so
179-
180-
FROM php:8.0.18-cli-alpine3.15 as final
32+
FROM appwrite/base:0.1.0 as final
18133

18234
LABEL maintainer="[email protected]"
18335

@@ -231,38 +83,6 @@ ENV _APP_SERVER=swoole \
23183
_APP_MAINTENANCE_RETENTION_USAGE_HOURLY=8640000 \
23284
_APP_MAINTENANCE_INTERVAL=86400
23385

234-
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
235-
236-
RUN \
237-
apk update \
238-
&& apk add --no-cache --virtual .deps \
239-
make \
240-
automake \
241-
autoconf \
242-
gcc \
243-
g++ \
244-
curl-dev \
245-
&& apk add --no-cache \
246-
libstdc++ \
247-
certbot \
248-
rsync \
249-
brotli-dev \
250-
yaml-dev \
251-
imagemagick \
252-
imagemagick-dev \
253-
libmaxminddb-dev \
254-
certbot \
255-
docker-cli \
256-
libgomp \
257-
&& docker-php-ext-install sockets opcache pdo_mysql \
258-
&& apk del .deps \
259-
&& rm -rf /var/cache/apk/*
260-
261-
RUN \
262-
mkdir -p $DOCKER_CONFIG/cli-plugins \
263-
&& ARCH=$(uname -m) && if [ $ARCH == "armv7l" ]; then ARCH="armv7"; fi \
264-
&& curl -SL https://github.com/docker/compose/releases/download/$DOCKER_COMPOSE_VERSION/docker-compose-linux-$ARCH -o $DOCKER_CONFIG/cli-plugins/docker-compose \
265-
&& chmod +x $DOCKER_CONFIG/cli-plugins/docker-compose
26686

26787
RUN \
26888
if [ "$DEBUG" == "true" ]; then \
@@ -273,15 +93,6 @@ WORKDIR /usr/src/code
27393

27494
COPY --from=composer /usr/local/src/vendor /usr/src/code/vendor
27595
COPY --from=node /usr/local/src/console/build /usr/src/code/console
276-
COPY --from=swoole /usr/local/lib/php/extensions/no-debug-non-zts-20200930/swoole.so /usr/local/lib/php/extensions/no-debug-non-zts-20200930/yasd.so* /usr/local/lib/php/extensions/no-debug-non-zts-20200930/
277-
COPY --from=redis /usr/local/lib/php/extensions/no-debug-non-zts-20200930/redis.so /usr/local/lib/php/extensions/no-debug-non-zts-20200930/
278-
COPY --from=imagick /usr/local/lib/php/extensions/no-debug-non-zts-20200930/imagick.so /usr/local/lib/php/extensions/no-debug-non-zts-20200930/
279-
COPY --from=yaml /usr/local/lib/php/extensions/no-debug-non-zts-20200930/yaml.so /usr/local/lib/php/extensions/no-debug-non-zts-20200930/
280-
COPY --from=maxmind /usr/local/lib/php/extensions/no-debug-non-zts-20200930/maxminddb.so /usr/local/lib/php/extensions/no-debug-non-zts-20200930/
281-
COPY --from=mongodb /usr/local/lib/php/extensions/no-debug-non-zts-20200930/mongodb.so /usr/local/lib/php/extensions/no-debug-non-zts-20200930/
282-
COPY --from=memcached /usr/local/lib/php/extensions/no-debug-non-zts-20200930/memcached.so /usr/local/lib/php/extensions/no-debug-non-zts-20200930/
283-
COPY --from=scrypt /usr/local/lib/php/extensions/php-scrypt/target/libphp_scrypt.so /usr/local/lib/php/extensions/no-debug-non-zts-20200930/
284-
COPY --from=zstd /usr/local/lib/php/extensions/no-debug-non-zts-20200930/zstd.so /usr/local/lib/php/extensions/no-debug-non-zts-20200930/
28596

28697
# Add Source Code
28798
COPY ./app /usr/src/code/app
@@ -333,13 +144,6 @@ RUN chmod +x /usr/local/bin/doctor && \
333144
RUN mkdir -p /etc/letsencrypt/live/ && chmod -Rf 755 /etc/letsencrypt/live/
334145

335146
# Enable Extensions
336-
RUN echo extension=swoole.so >> /usr/local/etc/php/conf.d/swoole.ini
337-
RUN echo extension=redis.so >> /usr/local/etc/php/conf.d/redis.ini
338-
RUN echo extension=imagick.so >> /usr/local/etc/php/conf.d/imagick.ini
339-
RUN echo extension=yaml.so >> /usr/local/etc/php/conf.d/yaml.ini
340-
RUN echo extension=maxminddb.so >> /usr/local/etc/php/conf.d/maxminddb.ini
341-
RUN echo extension=libphp_scrypt.so >> /usr/local/etc/php/conf.d/libphp_scrypt.ini
342-
RUN echo extension=zstd.so >> /usr/local/etc/php/conf.d/zstd.ini
343147
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
344148

345149
RUN if [ "$DEBUG" == "true" ]; then echo "opcache.enable=0" >> /usr/local/etc/php/conf.d/appwrite.ini; fi

app/console

Submodule console updated 41 files

composer.lock

Lines changed: 20 additions & 20 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)