-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
73 lines (56 loc) · 2.33 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
FROM php:7.4-cli AS builder
# See https://github.com/spiral/roadrunner/releases
ENV ROADRUNNER_VERSION 1.6.0
# Install libzip and unzip required by the zip extension
RUN apt-get update && apt-get install -y --no-install-recommends \
libzip-dev \
unzip
# Install ZIP extension required by composer
RUN docker-php-ext-install zip
# Install Composer
RUN php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" \
&& php -r "if (hash_file('SHA384', 'composer-setup.php') === rtrim(file_get_contents('https://composer.github.io/installer.sig'))) { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;" \
&& php composer-setup.php --install-dir=/usr/local/bin --filename=composer
# Download RoadRunner
RUN mkdir /tmp/rr \
&& cd /tmp/rr \
&& echo "{\"require\":{\"spiral/roadrunner\":\"${ROADRUNNER_VERSION}\"}}" >> composer.json \
&& composer install \
&& vendor/bin/rr get-binary
FROM php:7.4-cli
# Install dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
procps \
inotify-tools
# Add dependencies for extensions to this list
# Install extensions
# See below for a list of other available extensions:
# https://gist.github.com/giansalex/2776a4206666d940d014792ab4700d80
# The sockets extension is required for the roadrunner bridge to work
RUN docker-php-ext-install sockets
#RUN docker-php-ext-install opcache
#RUN docker-php-ext-install pdo
#RUN docker-php-ext-install pdo_mysql
# Copy the roadrunner binary
COPY --from=builder /tmp/rr/rr /usr/local/bin/rr
# Copy the PHP configuration file
COPY php.ini /usr/local/etc/php/php.ini
# Copy the application files
# You should add additional folders (templates, translations, assets etc.) to
# this list. Take care of the order you add things in: Put those directories
# that change most often to the bottom of the list.
COPY ./bin /var/www/bin
COPY ./public /var/www/public
COPY ./vendor /var/www/vendor
COPY ./config /var/www/config
COPY ./src /var/www/src
COPY ./var /var/www/var
COPY ./.env /var/www/.env
# Change the working directory to the web files
WORKDIR /var/www
# We want the container to run in a production environment by default
ENV APP_ENV=prod
# Warm up the Symfony cache
RUN php bin/console cache:warmup
# Run roadrunner
ENTRYPOINT ["/usr/local/bin/rr", "serve", "-c", ".rr.yaml"]