-
-
Notifications
You must be signed in to change notification settings - Fork 200
Expand file tree
/
Copy pathDockerfile
More file actions
94 lines (83 loc) 路 3.51 KB
/
Copy pathDockerfile
File metadata and controls
94 lines (83 loc) 路 3.51 KB
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
ARG BASE_OS_VERSION='bookworm'
ARG PHP_VERSION='8.5'
ARG PHP_VARIATION='cli'
##########
# CLI: Main Image
##########
FROM php:${PHP_VERSION}-${PHP_VARIATION}-${BASE_OS_VERSION}
ARG DEPENDENCY_PACKAGES_ALPINE='shadow'
ARG DEPENDENCY_PACKAGES_DEBIAN='procps zip'
ARG DEPENDENCY_PHP_EXTENSIONS='opcache pcntl pdo_mysql pdo_pgsql redis zip'
ARG REPOSITORY_BUILD_VERSION='dev'
LABEL org.opencontainers.image.title="serversideup/php (cli)" \
org.opencontainers.image.description="Supercharge your PHP experience. Based off the official PHP images, serversideup/php includes pre-configured PHP extensions and settings for enhanced performance and security. Optimized for Laravel and WordPress." \
org.opencontainers.image.url="https://serversideup.net/open-source/docker-php/" \
org.opencontainers.image.source="https://github.com/serversideup/docker-php" \
org.opencontainers.image.documentation="https://serversideup.net/open-source/docker-php/docs/" \
org.opencontainers.image.vendor="ServerSideUp" \
org.opencontainers.image.authors="Jay Rogers (@jaydrogers)" \
org.opencontainers.image.version="${REPOSITORY_BUILD_VERSION}" \
org.opencontainers.image.licenses="GPL-3.0-or-later"
ENV APP_BASE_DIR=/var/www/html \
COMPOSER_ALLOW_SUPERUSER=1 \
COMPOSER_HOME=/composer \
COMPOSER_MAX_PARALLEL_HTTP=24 \
DISABLE_DEFAULT_CONFIG=false \
LOG_OUTPUT_LEVEL=warn \
PHP_DATE_TIMEZONE="UTC" \
PHP_DISPLAY_ERRORS=Off \
PHP_DISPLAY_STARTUP_ERRORS=Off \
PHP_ERROR_LOG="/dev/stderr" \
PHP_ERROR_REPORTING="22527" \
PHP_MAX_EXECUTION_TIME="99" \
PHP_MAX_INPUT_TIME="-1" \
PHP_MAX_INPUT_VARS="1000" \
PHP_MEMORY_LIMIT="256M" \
PHP_OPCACHE_ENABLE="0" \
PHP_OPCACHE_ENABLE_FILE_OVERRIDE="0" \
PHP_OPCACHE_FORCE_RESTART_TIMEOUT="180" \
PHP_OPCACHE_INTERNED_STRINGS_BUFFER="8" \
PHP_OPCACHE_JIT="off" \
PHP_OPCACHE_JIT_BUFFER_SIZE="0" \
PHP_OPCACHE_MAX_ACCELERATED_FILES="10000" \
PHP_OPCACHE_MEMORY_CONSUMPTION="128" \
PHP_OPCACHE_REVALIDATE_FREQ="2" \
PHP_OPCACHE_SAVE_COMMENTS="1" \
PHP_OPCACHE_VALIDATE_TIMESTAMPS="1" \
PHP_OPEN_BASEDIR="" \
PHP_POST_MAX_SIZE="100M" \
PHP_HTML_ERRORS="1" \
PHP_REALPATH_CACHE_SIZE="4M" \
PHP_REALPATH_CACHE_TTL="120" \
PHP_SESSION_COOKIE_HTTPONLY="0" \
PHP_SESSION_COOKIE_SECURE=false \
PHP_UPLOAD_MAX_FILE_SIZE="100M" \
PHP_ZEND_DETECT_UNICODE="" \
PHP_ZEND_MULTIBYTE="Off" \
SHOW_WELCOME_MESSAGE=true
# copy our scripts
COPY --chmod=755 src/common/ /
# install pecl extensions & dependencies
RUN docker-php-serversideup-dep-install-alpine "${DEPENDENCY_PACKAGES_ALPINE}" && \
docker-php-serversideup-dep-install-debian "${DEPENDENCY_PACKAGES_DEBIAN}" && \
docker-php-serversideup-install-php-ext-installer && \
\
# Ensure /var/www/ has the correct permissions
chown -R www-data:www-data /var/www && \
chmod -R 755 /var/www && \
\
# Set the image version
echo "${REPOSITORY_BUILD_VERSION}" > /etc/serversideup-php-version && \
\
# Make composer cache directory
mkdir -p "${COMPOSER_HOME}" && \
chown -R www-data:www-data "${COMPOSER_HOME}" && \
\
# Install default PHP extensions
install-php-extensions ${DEPENDENCY_PHP_EXTENSIONS}
# install composer from Composer's official Docker image
COPY --from=composer:2 /usr/bin/composer /usr/bin/composer
RUN docker-php-serversideup-set-file-permissions --owner www-data:www-data --service cli
WORKDIR ${APP_BASE_DIR}
USER www-data
ENTRYPOINT ["docker-php-serversideup-entrypoint"]