-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
69 lines (57 loc) · 2.1 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
# Use the official PHP image.
# https://hub.docker.com/_/php
FROM php:8.1-apache
# Configure PHP for Cloud Run.
# Precompile PHP code with opcache.
RUN docker-php-ext-install -j "$(nproc)" opcache
# RUN docker-php-ext-install -j "$(nproc)" memcache
RUN set -ex; \
{ \
# echo "; Cloud Run enforces memory & timeouts"; \
# echo "memory_limit = -1"; \
# echo "max_execution_time = 0"; \
# echo "; File upload at Cloud Run network limit"; \
# echo "upload_max_filesize = 32M"; \
# echo "post_max_size = 32M"; \
echo "; Configure Opcache for Containers"; \
echo "opcache.enable = On"; \
echo "opcache.validate_timestamps = Off"; \
echo "; Configure Opcache Memory (Application-specific)"; \
echo "opcache.memory_consumption = 128"; \
} > "$PHP_INI_DIR/conf.d/app-engine.ini"
RUN uname -srm
RUN apt-get -y update
RUN apt-get update && apt-get -qq install \
libpq-dev \
libmagickwand-dev \
libzip-dev \
libmemcached-dev \
memcached \
jq \
libonig-dev \
python3.10 \
pip \
&& rm -rf /var/lib/apt/lists/*
RUN pip install supervisor --break-system-packages
COPY supervisord.conf /etc/supervisord.conf
RUN pecl install \
imagick \
memcached \
memcache \
xdebug \
zlib \
&& docker-php-ext-install -j "$(nproc)" iconv bcmath mbstring pdo_pgsql gd zip intl \
&& docker-php-ext-enable imagick memcached memcache xdebug
RUN php -m
# Use the PORT environment variable in Apache configuration files.
# https://cloud.google.com/run/docs/reference/container-contract#port
RUN sed -i 's/80/${PORT}/g' /etc/apache2/sites-available/000-default.conf /etc/apache2/ports.conf && \
sed -i 's/DocumentRoot \/var\/www\/html/DocumentRoot \/var\/www\/html\/web/g' /etc/apache2/sites-available/000-default.conf && \
a2enmod rewrite headers && \
# The next line disables gzip compression. Added on 7/19/22 by Jared Trouth for troubleshooting.
a2dismod -f deflate
COPY php.ini-production "$PHP_INI_DIR/php.ini"
COPY 000-default.conf /etc/apache2/sites-available/000-default.conf
COPY docker-entrypoint.sh /
ENTRYPOINT [ "/docker-entrypoint.sh" ]
CMD [ "apache2-foreground" ]