-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
146 lines (131 loc) · 5.43 KB
/
Copy pathDockerfile
File metadata and controls
146 lines (131 loc) · 5.43 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
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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
ARG LINUX_DISTRIBUTION=alpine
ARG project_root='/'
ARG NODE_MAJOR=24
ARG PHP_VERSION=8.5
# Node and Composer are already installed in the node_builder and composer_builder stages
FROM composer:latest AS composer_builder
FROM node:${NODE_MAJOR}-${LINUX_DISTRIBUTION} AS node_builder
FROM php:${PHP_VERSION}-fpm-${LINUX_DISTRIBUTION} AS base
# PHP extensions installed into the final image
# amqp - RabbitMQ extension
# bcmath - Arbitrary precision mathematics
# calendar - Calendar conversion functions
# gd - Image processing for gd extension
# intl - Internationalization for intl extension
# pdo_pgsql - PostgreSQL driver for PDO
# pgsql - PostgreSQL driver
# pg_query - SQL query parsing extension used in MCP for parsing SQL queries
# redis - Redis extension
# zip - Zip archive handling for zip extension
#
# Runtime dependencies needed in the final image
# bash - Shell for running scripts
# bash-completion - Bash completions for CLI tools
# ca-certificates - Certificates for secure connections
# coreutils - Basic file, shell and text manipulation utilities
# freetype - Font rendering for gd extension
# git - Required by pie (PHP Installer for Extensions) when fetching extension sources and by composer-patches for applying patches during composer install
# htop - Interactive process viewer for monitoring
# icu-data-full - ICU data for full locale support for intl extension
# icu-libs - ICU libraries for intl extension
# jpeg - Image format for gd extension
# libpng - Image format for gd extension
# libzip - Zip archive handling for zip extension
# musl-locales - Locales for internationalization
# nano - Text editor for editing files
# openssl - Secure communication for OpenSSL
# patch - Patch utility for applying patches
# postgresql18-client - PostgreSQL 18 client for connecting to databases
# protobuf-c - protobuf-c runtime library needed for pg_query extension (flow-php/pg-query-ext) used in MCP for parsing SQL queries
# rabbitmq-c - RabbitMQ client for connecting to message broker
# vim - Text editor for editing files
#
# Build dependencies installed as .build-deps and removed after extension installation, so they are not present in the final image
# autoconf - Required for compiling extensions
# freetype-dev - Development files for FreeType (font rendering) needed for gd extension
# g++ - Compiler for gd extension
# icu-dev - Development files for ICU (International Components for Unicode) needed for intl extension
# jpeg-dev - Development files for JPEG (image format) needed for gd extension
# libpng-dev - Development files for PNG (image format) needed for gd extension
# libpq-dev - Development files for PostgreSQL needed for pdo_pgsql and pgsql extensions
# libzip-dev - Development files for libzip needed for zip extension
# make - Required for compiling extensions
# openssl-dev - Development files for OpenSSL
# protobuf-c-dev - Development files for protobuf-c needed for pg_query extension (flow-php/pg-query-ext) used in MCP for parsing SQL queries
# rabbitmq-c-dev - Development files for RabbitMQ
RUN apk add --no-cache \
bash \
bash-completion \
ca-certificates \
coreutils \
freetype \
git \
htop \
icu-data-full \
icu-libs \
jpeg \
libpng \
libzip \
musl-locales \
nano \
openssl \
patch \
postgresql18-client \
protobuf-c \
rabbitmq-c \
vim && \
apk add --no-cache --virtual .build-deps \
autoconf \
freetype-dev \
g++ \
icu-dev \
jpeg-dev \
libpng-dev \
libpq-dev \
libzip-dev \
make \
openssl-dev \
protobuf-c-dev \
rabbitmq-c-dev && \
curl -fsSL https://github.com/php/pie/releases/latest/download/pie.phar -o /usr/local/bin/pie && \
chmod +x /usr/local/bin/pie && \
pecl install redis && \
docker-php-ext-enable redis && \
pecl install amqp && \
docker-php-ext-enable amqp && \
docker-php-ext-configure gd --with-freetype --with-jpeg && \
docker-php-ext-install \
bcmath \
calendar \
gd \
intl \
pdo_pgsql \
pgsql \
zip && \
pie install flow-php/pg-query-ext && \
rm /usr/local/bin/pie && \
apk del .build-deps
ENV LANG=en_US.UTF-8
ENV LANGUAGE=en_US:en
ENV LC_ALL=en_US.UTF-8
# Copy Composer from composer_builder stage
COPY --from=composer_builder /usr/bin/composer /usr/local/bin/composer
# Symbolic link for Node.js
COPY --from=node_builder \
/usr/local/bin/node \
/usr/local/bin/npm \
/usr/local/bin/
COPY --from=node_builder /usr/local/lib/node_modules /usr/local/lib/node_modules
COPY --from=node_builder /usr/local/include/node /usr/local/include/node
RUN if [ -e "/usr/local/bin/npm" ]; then rm /usr/local/bin/npm; fi && ln -s /usr/local/lib/node_modules/npm/bin/npm-cli.js /usr/local/bin/npm
COPY ./docker-php-entrypoint /usr/local/bin/
RUN chmod +x /usr/local/bin/docker-php-entrypoint
# Cachetool for opcache management
RUN curl -sL https://github.com/gordalina/cachetool/releases/latest/download/cachetool.phar -o /usr/local/bin/cachetool && \
chmod +x /usr/local/bin/cachetool
RUN chown -R www-data:www-data /var/www/html
COPY ./phing-completion /etc/bash_completion.d/phing
RUN echo "source /etc/profile.d/bash_completion.sh" >> ~/.bash_profile
USER www-data
RUN mkdir -p /var/www/html/.npm-global
ENV NPM_CONFIG_PREFIX=/var/www/html/.npm-global