Now stuff is installed in the container instead of the image

This commit is contained in:
eroncero
2025-08-05 15:41:26 +02:00
parent 8df5735249
commit 0e9c43d34d
12 changed files with 55 additions and 37 deletions

2
.env
View File

@@ -14,4 +14,4 @@ NGINX_HTTPS_IPV6_PORT=8843
NGINX_CONTAINER_HTTP_PORT=80
NGINX_CONTAINER_HTTPS_PORT=443
PHP_VERSIONS=
PHP_VERSIONS=7.4 7.2

View File

@@ -1,6 +1,7 @@
#!/bin/sh
service mariadb start
# Run the CMD that was passed (or default)
exec "$@"

View File

@@ -1,21 +1,20 @@
FROM debian:bookworm
ARG DEBIAN_FRONTEND=noninteractive
ARG DEBCONF_NONINTERACTIVE_SEEN=true
RUN apt-get update; apt-get full-upgrade -y; apt-get autoclean -y && apt install iputils-ping -y
ENV DEBIAN_FRONTEND=noninteractive
ENV DEBCONF_NONINTERACTIVE_SEEN=true
RUN apt-get update; apt-get full-upgrade -y; apt-get autoclean -y && apt-get install iputils-ping -y
COPY project/buildtime/sury-repo.sh /tmp/buildtime/sury-repo.sh
RUN /bin/sh /tmp/buildtime/sury-repo.sh
ARG BUILDTIME_PHP_VER_INST="8.2"
ENV BUILDTIME_PHP_VER_INST="8.2"
COPY project/buildtime/buildtime_php_ver_inst.sh /tmp/buildtime/buildtime_php_ver_inst.sh
COPY project/buildtime/preserve-files.sh /tmp/buildtime/preserve-files.sh
RUN /bin/sh /tmp/buildtime/buildtime_php_ver_inst.sh
ENV DEF_PHP_INTERPRETER="8.2"
ENV PHP_VERSIONS=
COPY project/entrypoint/entrypoint.sh /entrypoint/entrypoint.sh
COPY project/entrypoint/container-php-ver-inst.sh /entrypoint/container-php-ver-inst.sh
COPY project/entrypoint/install-php-versions.sh /entrypoint/install-php-versions.sh
COPY project/entrypoint/start-php-fpm.sh /entrypoint/start-php-fpm.sh
RUN /bin/sh /tmp/buildtime/preserve-files.sh
ENTRYPOINT ["/bin/sh", "/entrypoint/entrypoint.sh"]

View File

@@ -4,7 +4,7 @@ apt-get update
BUILDTIME_PHP_VER_INST="8.2"
apt-get install -y \
apt-get install -y --download-only \
php$BUILDTIME_PHP_VER_INST-fpm \
php$BUILDTIME_PHP_VER_INST-bcmath \
php$BUILDTIME_PHP_VER_INST-bz2 \

View File

@@ -1,4 +0,0 @@
#!/bin/sh
mkdir -p /tmp/buildtime/etc/php
mv /etc/php/* /tmp/buildtime/etc/php/

View File

@@ -1,7 +1,7 @@
#!/bin/sh
# To add this repository please do:
apt-get -y install lsb-release ca-certificates curl
apt-get install lsb-release ca-certificates curl -y
curl -sSLo /tmp/debsuryorg-archive-keyring.deb https://packages.sury.org/debsuryorg-archive-keyring.deb
dpkg -i /tmp/debsuryorg-archive-keyring.deb
sh -c 'echo "deb [signed-by=/usr/share/keyrings/debsuryorg-archive-keyring.gpg] https://packages.sury.org/php/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/php.list'

View File

@@ -0,0 +1,40 @@
#!/bin/sh
apt-get update
apt-get install -y \
php$BUILDTIME_PHP_VER_INST-fpm \
php$BUILDTIME_PHP_VER_INST-bcmath \
php$BUILDTIME_PHP_VER_INST-bz2 \
php$BUILDTIME_PHP_VER_INST-common \
php$BUILDTIME_PHP_VER_INST-curl \
php$BUILDTIME_PHP_VER_INST-dba \
php$BUILDTIME_PHP_VER_INST-enchant \
php$BUILDTIME_PHP_VER_INST-gd \
php$BUILDTIME_PHP_VER_INST-gmp \
php$BUILDTIME_PHP_VER_INST-http \
php$BUILDTIME_PHP_VER_INST-imap \
php$BUILDTIME_PHP_VER_INST-interbase \
php$BUILDTIME_PHP_VER_INST-intl \
php$BUILDTIME_PHP_VER_INST-ldap \
php$BUILDTIME_PHP_VER_INST-mbstring \
php$BUILDTIME_PHP_VER_INST-memcache \
php$BUILDTIME_PHP_VER_INST-memcached \
php$BUILDTIME_PHP_VER_INST-mysql \
php$BUILDTIME_PHP_VER_INST-odbc \
php$BUILDTIME_PHP_VER_INST-opcache \
php$BUILDTIME_PHP_VER_INST-pgsql \
php$BUILDTIME_PHP_VER_INST-ps \
php$BUILDTIME_PHP_VER_INST-pspell \
php$BUILDTIME_PHP_VER_INST-raphf \
php$BUILDTIME_PHP_VER_INST-readline \
php$BUILDTIME_PHP_VER_INST-snmp \
php$BUILDTIME_PHP_VER_INST-soap \
php$BUILDTIME_PHP_VER_INST-sqlite3 \
php$BUILDTIME_PHP_VER_INST-stomp \
php$BUILDTIME_PHP_VER_INST-sybase \
php$BUILDTIME_PHP_VER_INST-tidy \
php$BUILDTIME_PHP_VER_INST-xdebug \
php$BUILDTIME_PHP_VER_INST-xml \
php$BUILDTIME_PHP_VER_INST-xsl \
php$BUILDTIME_PHP_VER_INST-zip \

View File

@@ -1,9 +1,10 @@
#!/bin/sh
/bin/sh /entrypoint/container-php-ver-inst.sh
/bin/sh /entrypoint/install-php-versions.sh
# Run the CMD that was passed (or default)
#exec "$@"
exec "$@"
tail -f /dev/null

View File

@@ -1,7 +1,5 @@
#!/bin/sh
mkdir -p /etc/php # Creates /etc/php if it doesn't exist
mv /tmp/buildtime/etc/php/* /etc/php/
# Start each version listed in PHP_VERSIONS
for version in $PHP_VERSIONS; do

View File

@@ -3,12 +3,8 @@ FROM debian:bookworm
ARG DEBIAN_FRONTEND=noninteractive
ARG DEBCONF_NONINTERACTIVE_SEEN=true
RUN apt-get update; apt-get full-upgrade -y; apt-get autoclean -y; apt-get install nginx certbot python3-certbot-nginx openssl vim curl iputils-ping -y
RUN apt-get update; apt-get full-upgrade -y; apt-get autoclean -y; apt-get install nginx certbot python3-certbot-nginx openssl vim curl iputils-ping -y --download-only
COPY project/entrypoint/entrypoint.sh /entrypoint/entrypoint.sh
COPY project/entrypoint/gen-cert.sh /entrypoint/gen-cert.sh
#COPY project/entrypoint/install-nginx-mods.sh /entrypoint/install-nginx-mods.sh
RUN mkdir /tmp/buildtime && cp /etc/nginx/sites-available/default /tmp/buildtime/default
RUN mkdir /tmp/buildtime/www && cp -r /var/www/. /tmp/buildtime/www/
RUN mkdir /tmp/buildtime/letsencrypt && cp -r /etc/letsencrypt/. /tmp/buildtime/letsencrypt/
ENTRYPOINT ["/bin/sh", "/entrypoint/entrypoint.sh"]

View File

@@ -2,21 +2,7 @@
/bin/sh /entrypoint/gen-cert.sh
for file in /etc/nginx/sites-available/*.conf; do
ln -s "$file" "/etc/nginx/sites-enabled/"
done
rm /etc/nginx/sites-enabled/*.conf
mv /tmp/buildtime/default /etc/nginx/sites-available/default
if [ "$(ls -A /etc/letsencrypt)" ]; then
mv /tmp/buildtime/letsencrypt/* /etc/letsencrypt
fi
# One-liner with test
cp -a /tmp/buildtime/www/html* /var/www/html && rm -rf /tmp/buildtime/www/html
chown -R www-data:www-data /var/www
service nginx start
# Run the CMD that was passed (or default)
exec "$@"
tail -f /dev/null

View File

@@ -5,6 +5,7 @@ mkdir -p /etc/ssl/private
chmod 0710 /etc/ssl/private
# Generate a fresh cert every time
apt-get install -y openssl
openssl req -x509 -newkey rsa:4096 -sha256 -days 3650 -nodes \
-keyout /etc/ssl/private/ssl-cert-snakeoil.key \
-out /etc/ssl/certs/ssl-cert-snakeoil.pem \