Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build-packages.sh
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,6 @@ fpm -s dir -t deb -n frankenphp -v "${FRANKENPHP_VERSION}" \
"../package/empty/=/var/lib/frankenphp"

[ "$user_preexists" -eq 0 ] && sudo userdel frankenphp
[ "$group_preexists" -eq 0 ] && sudo groupdel frankenphp
[ "$group_preexists" -eq 0 ] && (sudo groupdel frankenphp || true)

cd ..
162 changes: 87 additions & 75 deletions static-builder-gnu.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -37,73 +37,74 @@ LABEL org.opencontainers.image.vendor="Kévin Dunglas"

# yum update
RUN sed -i 's/mirror.centos.org/vault.centos.org/g' /etc/yum.repos.d/*.repo && \
sed -i 's/^#.*baseurl=http/baseurl=http/g' /etc/yum.repos.d/*.repo && \
sed -i 's/^mirrorlist=http/#mirrorlist=http/g' /etc/yum.repos.d/*.repo && \
yum clean all && \
yum makecache && \
yum update -y && \
yum install -y centos-release-scl
sed -i 's/^#.*baseurl=http/baseurl=http/g' /etc/yum.repos.d/*.repo && \
sed -i 's/^mirrorlist=http/#mirrorlist=http/g' /etc/yum.repos.d/*.repo && \
yum clean all && \
yum makecache && \
yum update -y && \
yum install -y centos-release-scl

# different arch for different scl repo
RUN if [ "$(uname -m)" = "aarch64" ]; then \
sed -i 's|mirror.centos.org/centos|vault.centos.org/altarch|g' /etc/yum.repos.d/CentOS-SCLo-scl-rh.repo ; \
sed -i 's|mirror.centos.org/centos|vault.centos.org/altarch|g' /etc/yum.repos.d/CentOS-SCLo-scl.repo ; \
sed -i 's/^#.*baseurl=http/baseurl=http/g' /etc/yum.repos.d/*.repo ; \
sed -i 's/^mirrorlist=http/#mirrorlist=http/g' /etc/yum.repos.d/*.repo ; \
else \
sed -i 's/mirror.centos.org/vault.centos.org/g' /etc/yum.repos.d/*.repo ; \
sed -i 's/^#.*baseurl=http/baseurl=http/g' /etc/yum.repos.d/*.repo ; \
sed -i 's/^mirrorlist=http/#mirrorlist=http/g' /etc/yum.repos.d/*.repo ; \
fi ; \
yum update -y && \
yum install -y devtoolset-10-gcc-* && \
echo "source scl_source enable devtoolset-10" >> /etc/bashrc && \
source /etc/bashrc
sed -i 's|mirror.centos.org/centos|vault.centos.org/altarch|g' /etc/yum.repos.d/CentOS-SCLo-scl-rh.repo ; \
sed -i 's|mirror.centos.org/centos|vault.centos.org/altarch|g' /etc/yum.repos.d/CentOS-SCLo-scl.repo ; \
sed -i 's/^#.*baseurl=http/baseurl=http/g' /etc/yum.repos.d/*.repo ; \
sed -i 's/^mirrorlist=http/#mirrorlist=http/g' /etc/yum.repos.d/*.repo ; \
else \
sed -i 's/mirror.centos.org/vault.centos.org/g' /etc/yum.repos.d/*.repo ; \
sed -i 's/^#.*baseurl=http/baseurl=http/g' /etc/yum.repos.d/*.repo ; \
sed -i 's/^mirrorlist=http/#mirrorlist=http/g' /etc/yum.repos.d/*.repo ; \
fi; \
yum update -y && \
yum install -y devtoolset-10-gcc-* && \
echo "source scl_source enable devtoolset-10" >> /etc/bashrc && \
source /etc/bashrc

# install newer cmake to build some newer libs
RUN curl -o cmake.tgz -fsSL https://github.com/Kitware/CMake/releases/download/v3.31.4/cmake-3.31.4-linux-$(uname -m).tar.gz && \
mkdir /cmake && \
tar -xzf cmake.tgz -C /cmake --strip-components 1 && \
rm cmake.tgz
RUN curl -o cmake.tar.gz -fsSL https://github.com/Kitware/CMake/releases/download/v3.31.4/cmake-3.31.4-linux-$(uname -m).tar.gz && \
mkdir /cmake && \
tar -xzf cmake.tar.gz -C /cmake --strip-components 1 && \
rm cmake.tar.gz

# install build essentials
RUN yum install -y \
perl \
make \
bison \
flex \
git \
autoconf \
automake \
tar \
unzip \
gzip \
gcc \
bzip2 \
patch \
xz \
libtool \
perl-IPC-Cmd ; \
curl -o make.tgz -fsSL https://ftp.gnu.org/gnu/make/make-4.4.tar.gz && \
tar -zxvf make.tgz && \
rm make.tgz && \
cd make-4.4 && \
./configure && \
make && \
make install && \
ln -sf /usr/local/bin/make /usr/bin/make ; \
if [ "$(uname -m)" = "aarch64" ]; then \
GO_ARCH="arm64" ; \
else \
GO_ARCH="amd64" ; \
fi ; \
curl -o /usr/local/bin/jq -fsSL https://github.com/jqlang/jq/releases/download/jq-1.7.1/jq-linux-${GO_ARCH} && \
chmod +x /usr/local/bin/jq && \
curl -o go.tar.gz -fsSL https://go.dev/dl/$(curl -fsS https://go.dev/dl/?mode=json | jq -r "first(first(.[] | select(.stable and (.version | startswith(\"go${GO_VERSION}\")))).files[] | select(.os == \"linux\" and (.kind == \"archive\") and (.arch == \"${GO_ARCH}\"))).filename") && \
rm -rf /usr/local/go && \
tar -C /usr/local -xzf go.tar.gz && \
rm go.tar.gz && \
/usr/local/go/bin/go install github.com/caddyserver/xcaddy/cmd/xcaddy@latest
perl \
make \
bison \
flex \
git \
autoconf \
automake \
tar \
unzip \
gzip \
gcc \
bzip2 \
patch \
xz \
libtool \
perl-IPC-Cmd ; \
curl -o make.tar.gz -fsSL https://ftp.gnu.org/gnu/make/make-4.4.tar.gz && \
tar -zxvf make.tar.gz && \
cd make-* && \
./configure && \
make && \
make install && \
ln -sf /usr/local/bin/make /usr/bin/make && \
cd .. && \
rm -Rf make* && \
if [ "$(uname -m)" = "aarch64" ]; then \
GO_ARCH="arm64" ; \
else \
GO_ARCH="amd64" ; \
fi; \
curl -o /usr/local/bin/jq -fsSL https://github.com/jqlang/jq/releases/download/jq-1.7.1/jq-linux-${GO_ARCH} && \
chmod +x /usr/local/bin/jq && \
curl -o go.tar.gz -fsSL https://go.dev/dl/$(curl -fsS https://go.dev/dl/?mode=json | jq -r "first(first(.[] | select(.stable and (.version | startswith(\"go${GO_VERSION}\")))).files[] | select(.os == \"linux\" and (.kind == \"archive\") and (.arch == \"${GO_ARCH}\"))).filename") && \
rm -rf /usr/local/go && \
tar -C /usr/local -xzf go.tar.gz && \
rm go.tar.gz && \
/usr/local/go/bin/go install github.com/caddyserver/xcaddy/cmd/xcaddy@latest

ENV PATH="/cmake/bin:/usr/local/go/bin:$PATH"

Expand All @@ -124,18 +125,27 @@ ENV EXTENSION_DIR='/usr/lib/frankenphp/modules'
ENV COMPOSER_ALLOW_SUPERUSER=1

# install tools to build packages, if requested - needs gcc 10
RUN if [ "${BUILD_PACKAGES}" != "" ]; then \
yum install -y make bzip2 openssl-devel libffi-devel zlib-devel libyaml libyaml-devel rpm-build && \
curl -o ruby.tar.gz -fsSL https://cache.ruby-lang.org/pub/ruby/3.4/ruby-3.4.2.tar.gz && \
tar -xzf ruby.tar.gz && \
cd ruby-3.4.2 && \
./configure --without-baseruby && \
make && \
make install && \
cd .. && \
rm -rf ruby-3.4.2 ruby.tar.gz && \
gem install fpm; \
fi
RUN if [ -n "${BUILD_PACKAGES}" ]; then \
yum install -y \
bzip2 \
libffi-devel \
libyaml \
libyaml-devel \
make \
openssl-devel \
rpm-build \
sudo \
zlib-devel && \
curl -o ruby.tar.gz -fsSL https://cache.ruby-lang.org/pub/ruby/3.4/ruby-3.4.4.tar.gz && \
tar -xzf ruby.tar.gz && \
cd ruby-* && \
./configure --without-baseruby && \
make && \
make install && \
cd .. && \
rm -rf ruby* && \
gem install fpm; \
fi

WORKDIR /go/src/app
COPY go.mod go.sum ./
Expand All @@ -151,8 +161,10 @@ COPY --link caddy caddy
COPY --link internal internal
COPY --link package package

RUN --mount=type=secret,id=github-token ./build-static.sh && \
if [ "${BUILD_PACKAGES}" != "" ]; then \
./build-packages.sh; \
fi ; \
RUN --mount=type=secret,id=github-token \
set -eux; \
./build-static.sh && \
if [ -n "${BUILD_PACKAGES}" ]; then \
./build-packages.sh; \
fi; \
rm -Rf dist/static-php-cli/source/*
Loading