2021-09-24 16:52:20 +00:00
|
|
|
FROM golang
|
|
|
|
|
2022-10-04 12:36:03 +00:00
|
|
|
ARG LIBICONV_VERSION=1.17
|
|
|
|
ENV PHPIZE_DEPS \
|
|
|
|
autoconf \
|
|
|
|
dpkg-dev \
|
|
|
|
file \
|
|
|
|
g++ \
|
|
|
|
gcc \
|
|
|
|
libc-dev \
|
|
|
|
make \
|
|
|
|
pkg-config \
|
|
|
|
re2c
|
2021-09-24 16:52:20 +00:00
|
|
|
|
|
|
|
RUN apt-get update && \
|
2022-10-04 12:36:03 +00:00
|
|
|
apt-get -y --no-install-recommends install \
|
|
|
|
$PHPIZE_DEPS \
|
|
|
|
libargon2-dev \
|
|
|
|
libcurl4-openssl-dev \
|
|
|
|
libonig-dev \
|
|
|
|
libreadline-dev \
|
|
|
|
libsodium-dev \
|
|
|
|
libsqlite3-dev \
|
|
|
|
libssl-dev \
|
|
|
|
libxml2-dev \
|
|
|
|
zlib1g-dev \
|
|
|
|
bison \
|
|
|
|
&& \
|
|
|
|
apt-get clean
|
|
|
|
|
2022-10-13 16:05:22 +00:00
|
|
|
RUN git clone --depth=1 --single-branch --branch=frankenphp-8.2 https://github.com/dunglas/php-src.git && \
|
2022-10-04 12:36:03 +00:00
|
|
|
cd php-src && \
|
2022-10-13 16:05:22 +00:00
|
|
|
#export CFLAGS="-DNO_SIGPROF" && \
|
2021-09-24 16:52:20 +00:00
|
|
|
# --enable-embed is only necessary to generate libphp.so, we don't use this SAPI directly
|
2022-10-04 12:36:03 +00:00
|
|
|
./buildconf && \
|
2022-10-13 16:05:22 +00:00
|
|
|
./configure \
|
|
|
|
--enable-embed=static \
|
|
|
|
--enable-zts \
|
2022-10-15 16:57:16 +00:00
|
|
|
--disable-zend-signals \
|
|
|
|
--with-config-file-scan-dir=/usr/local/lib/php/ && \
|
2022-10-15 07:46:44 +00:00
|
|
|
make -j$(nproc) && \
|
2021-09-24 16:52:20 +00:00
|
|
|
make install && \
|
2022-10-13 16:05:22 +00:00
|
|
|
rm -Rf php-src/ && \
|
2022-10-04 12:36:03 +00:00
|
|
|
ldconfig && \
|
|
|
|
php --version
|
|
|
|
|
|
|
|
RUN echo "zend_extension=opcache.so\nopcache.enable=1" > /usr/local/lib/php.ini
|
2021-09-24 16:52:20 +00:00
|
|
|
|
|
|
|
WORKDIR /go/src/app
|
|
|
|
|
2022-10-13 16:05:22 +00:00
|
|
|
COPY go.mod go.sum ./
|
|
|
|
RUN go get -v ./...
|
|
|
|
|
|
|
|
RUN mkdir caddy && cd caddy
|
|
|
|
COPY go.mod go.sum ./
|
|
|
|
|
|
|
|
RUN go get -v ./... && \
|
|
|
|
cd ..
|
|
|
|
|
2021-09-24 16:52:20 +00:00
|
|
|
COPY . .
|
|
|
|
|
2022-10-13 16:05:22 +00:00
|
|
|
RUN cd caddy/frankenphp && \
|
|
|
|
go build && \
|
|
|
|
cp frankenphp /usr/local/bin && \
|
|
|
|
cp /go/src/app/caddy/frankenphp/Caddyfile /etc/Caddyfile && \
|
|
|
|
rm -Rf /go
|
|
|
|
|
|
|
|
WORKDIR /app
|
|
|
|
|
|
|
|
RUN mkdir -p /app/public
|
|
|
|
RUN echo '<?php phpinfo();' > /app/public/index.php
|
|
|
|
|
|
|
|
CMD [ "frankenphp", "run", "--config", "/etc/Caddyfile" ]
|