Skip to content

Commit 6741e8d

Browse files
authored
Merge pull request #89 from utopia-php/feat-parallel-compile-builds
Feat: parallel compile builds
2 parents 102ee1d + bc2c426 commit 6741e8d

File tree

4 files changed

+255
-238
lines changed

4 files changed

+255
-238
lines changed

Dockerfile

Lines changed: 31 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM composer:2.0 as step0
1+
FROM composer:2.0 as composer
22

33
ARG TESTING=false
44
ENV TESTING=$TESTING
@@ -11,46 +11,51 @@ COPY composer.json /usr/local/src/
1111
RUN composer update --ignore-platform-reqs --optimize-autoloader \
1212
--no-plugins --no-scripts --prefer-dist
1313

14-
FROM php:7.4-cli-alpine as final
15-
16-
LABEL maintainer="team@appwrite.io"
17-
18-
ENV PHP_SWOOLE_VERSION=v4.6.6
19-
ENV PHP_MONGO_VERSION=1.9.1
14+
FROM php:8.0-cli-alpine as compile
2015

2116
ENV PHP_REDIS_VERSION=5.3.4 \
22-
PHP_SWOOLE_VERSION=v4.6.7 \
23-
PHP_MONGO_VERSION=1.9.1
17+
PHP_SWOOLE_VERSION=v4.8.0 \
18+
PHP_MONGO_VERSION=1.11.1
2419

2520
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
2621

2722
RUN \
2823
apk update \
2924
&& apk add --no-cache postgresql-libs postgresql-dev make automake autoconf gcc g++ git brotli-dev \
3025
&& docker-php-ext-install opcache pgsql pdo_mysql pdo_pgsql \
31-
# Redis Extension
32-
&& git clone --depth 1 --branch $PHP_REDIS_VERSION https://github.com/phpredis/phpredis.git \
26+
&& rm -rf /var/cache/apk/*
27+
28+
# Redis Extension
29+
FROM compile AS redis
30+
RUN \
31+
git clone --depth 1 --branch $PHP_REDIS_VERSION https://github.com/phpredis/phpredis.git \
3332
&& cd phpredis \
3433
&& phpize \
3534
&& ./configure \
36-
&& make && make install \
37-
&& cd .. \
38-
## Swoole Extension
39-
&& git clone --depth 1 --branch $PHP_SWOOLE_VERSION https://github.com/swoole/swoole-src.git \
35+
&& make && make install
36+
37+
## Swoole Extension
38+
FROM compile AS swoole
39+
RUN \
40+
git clone --depth 1 --branch $PHP_SWOOLE_VERSION https://github.com/swoole/swoole-src.git \
4041
&& cd swoole-src \
4142
&& phpize \
4243
&& ./configure --enable-http2 \
43-
&& make && make install \
44-
&& cd .. \
45-
## MongoDB Extension
46-
&& git clone --depth 1 --branch $PHP_MONGO_VERSION https://github.com/mongodb/mongo-php-driver.git \
44+
&& make && make install
45+
46+
## MongoDB Extension
47+
FROM compile AS mongodb
48+
RUN \
49+
git clone --depth 1 --branch $PHP_MONGO_VERSION https://github.com/mongodb/mongo-php-driver.git \
4750
&& cd mongo-php-driver \
4851
&& git submodule update --init \
4952
&& phpize \
5053
&& ./configure \
51-
&& make && make install \
52-
&& cd .. \
53-
&& rm -rf /var/cache/apk/*
54+
&& make && make install
55+
56+
FROM compile as final
57+
58+
LABEL maintainer="team@appwrite.io"
5459

5560
WORKDIR /usr/src/code
5661

@@ -64,7 +69,10 @@ RUN echo "opcache.enable_cli=1" >> $PHP_INI_DIR/php.ini
6469

6570
RUN echo "memory_limit=1024M" >> $PHP_INI_DIR/php.ini
6671

67-
COPY --from=step0 /usr/local/src/vendor /usr/src/code/vendor
72+
COPY --from=composer /usr/local/src/vendor /usr/src/code/vendor
73+
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/
74+
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/
75+
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/
6876

6977
# Add Source Code
7078
COPY . /usr/src/code

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ Below is a list of supported adapters, and thier compatibly tested versions alon
162162

163163
## System Requirements
164164

165-
Utopia Framework requires PHP 7.3 or later. We recommend using the latest PHP version whenever possible.
165+
Utopia Framework requires PHP 8.0 or later. We recommend using the latest PHP version whenever possible.
166166

167167
## Tests
168168

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
"psr-4": {"Utopia\\Tests\\": "tests/Database"}
2323
},
2424
"require": {
25-
"php": ">=7.1",
25+
"php": ">=8.0",
2626
"ext-pdo": "*",
2727
"ext-redis": "*",
2828
"ext-mongodb": "*",

0 commit comments

Comments
 (0)