-
Notifications
You must be signed in to change notification settings - Fork 2
/
Dockerfile
126 lines (110 loc) · 3.13 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
FROM php:8.0.10-alpine as build-composer-stage
# Repository/Image Maintainer
LABEL maintainer="Leandro Henrique <[email protected]>"
# composer
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/bin --filename=composer
WORKDIR /app
COPY . .
# INSTALL
RUN echo -e "\n # ---> Installing Composer Dependencies \n" && \
composer install \
--no-interaction \
--no-progress \
--prefer-dist \
--no-autoloader \
--no-scripts \
--optimize-autoloader \
--no-dev \
--ignore-platform-reqs
RUN composer dump-autoload
# OPTIMIZE
RUN php artisan optimize
FROM php:8.0.10-alpine as production-stage
ENV SWOOLE_VERSION 4.7.1
WORKDIR /app
RUN apk add --no-cache \
freetype \
libjpeg-turbo \
libpng \
libstdc++ \
libbz2 \
bzip2 \
libzip \
libxml2 \
gmp \
zlib \
openssl \
yaml
RUN apk add --no-cache --virtual .build-deps $PHPIZE_DEPS \
\
linux-headers \
git \
make \
automake \
autoconf \
gcc \
g++ \
zlib-dev \
freetype-dev \
libjpeg-turbo-dev \
libpng-dev \
bzip2-dev \
libzip-dev \
libxml2-dev \
gmp-dev \
openssl-dev \
yaml-dev \
\
&& docker-php-ext-install \
\
calendar \
bz2 \
zip \
soap \
iconv \
exif \
gmp \
bcmath \
sockets \
mysqli \
pdo_mysql \
opcache \
\
&& docker-php-ext-configure gd --with-freetype --with-jpeg \
&& docker-php-ext-install -j$(nproc) gd \
\
&& pecl install redis yaml \
&& docker-php-ext-enable redis yaml \
&& mkdir -p /build \
&& cd /build \
&& git clone -b v${SWOOLE_VERSION} https://github.com/swoole/swoole-src.git \
&& cd swoole-src \
&& phpize \
&& ./configure --with-php-config=/usr/local/bin/php-config \
--enable-openssl \
--enable-http2 \
--enable-swoole-json \
&& make && make install \
&& cd && rm -rf /build \
&& apk del .build-deps
RUN echo -e "extension=swoole\nswoole.use_shortname='Off'" > /usr/local/etc/php/conf.d/docker-php-ext-swoole.ini
# pdo_pgsql
RUN set -ex \
&& apk --no-cache add postgresql-libs postgresql-dev \
&& docker-php-ext-install pgsql pdo_pgsql pcntl \
&& apk del postgresql-dev
# extensoes disponíveis
# bcmath bz2 calendar ctype curl dba dom enchant exif ffi fileinfo filter ftp gd gettext gmp hash iconv imap intl json ldap mbstring mysqli oci8 odbc opcache pcntl pdo pdo_dblib pdo_firebird pdo_mysql pdo_oci pdo_odbc pdo_pgsql pdo_sqlite pgsql phar posix pspell readline reflection session shmop simplexml snmp soap sockets sodium spl standard sysvmsg sysvsem sysvshm tidy tokenizer xml xmlreader xmlwriter xsl zend_test zip
# RUN rm -rf /var/cache/apk/*
# COPY SOURCE
COPY --from=build-composer-stage /app /app
# RUN php artisan config:cache && php artisan route:cache && php artisan view:cache
VOLUME [ "/app" ]
EXPOSE 80
# especificar trabalhadores
# --workers=4
# Especificar a quantidade de trabalhadores de tarefas
# --task-workers=6
# limitar quantidade de requisições por trabalhado para evitar vazamento de memória
# --max-requests=250
CMD ["php", "artisan", "octane:start", "--host=0.0.0.0", "--port=80"]