Compare commits

...

3 Commits

Author SHA1 Message Date
eroncero
0e9c43d34d Now stuff is installed in the container instead of the image 2025-08-05 15:41:26 +02:00
eroncero
8df5735249 beta image tag 2025-08-05 14:51:23 +02:00
eroncero
a50eadfab8 Install stuff after the container is created 2025-08-05 14:49:08 +02:00
15 changed files with 63 additions and 68 deletions

2
.env
View File

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

View File

@@ -1,6 +1,6 @@
services: services:
nginx-srv: nginx-srv:
image: eroncero/nginx-srv:latest image: eroncero/nginx-srv:beta
build: build:
context: ./nginx-srv context: ./nginx-srv
dockerfile: Dockerfile dockerfile: Dockerfile
@@ -18,7 +18,7 @@ services:
- ./nginx-srv/etc/letsencrypt:/etc/letsencrypt - ./nginx-srv/etc/letsencrypt:/etc/letsencrypt
multi-php-fpm: multi-php-fpm:
image: eroncero/multi-php-fpm image: eroncero/multi-php-fpm:beta
build: build:
context: ./multi-php-fpm context: ./multi-php-fpm
dockerfile: Dockerfile dockerfile: Dockerfile
@@ -32,7 +32,7 @@ services:
- ./mariadb-srv/run/mysql:/run/mysqld - ./mariadb-srv/run/mysql:/run/mysqld
mariadb-srv: mariadb-srv:
image: eroncero/mariadb-srv:latest image: eroncero/mariadb-srv:beta
build: build:
context: ./mariadb-srv context: ./mariadb-srv
dockerfile: Dockerfile dockerfile: Dockerfile

View File

@@ -1,13 +1,10 @@
FROM debian:bookworm FROM debian:bookworm
ARG DEBIAN_FRONTEND=noninteractive ENV DEBIAN_FRONTEND=noninteractive
ARG DEBCONF_NONINTERACTIVE_SEEN=true ENV DEBCONF_NONINTERACTIVE_SEEN=true
RUN apt-get update; apt-get full-upgrade -y; apt-get autoclean -y; apt-get install mariadb-server mariadb-client iputils-ping -y RUN apt-get update; apt-get full-upgrade -y; apt-get autoclean -y; apt-get install mariadb-server mariadb-client iputils-ping -y --download-only
COPY project/entrypoint/entrypoint.sh /entrypoint/entrypoint.sh COPY project/entrypoint/entrypoint.sh /entrypoint/entrypoint.sh
COPY project/entrypoint/fix_volumes.sh /entrypoint/fix_volumes.sh
#COPY project/entrypoint/gen-cert.sh /entrypoint/gen-cert.sh
RUN mkdir -p /tmp/buildtime/etc/mysql && cp -r /etc/mysql/. /tmp/buildtime/etc/mysql/
RUN mkdir -p /tmp/buildtime/var/lib/mysql && cp -r /var/lib/mysql/. /tmp/buildtime/var/lib/mysql/
ENTRYPOINT ["/bin/sh", "/entrypoint/entrypoint.sh"] ENTRYPOINT ["/bin/sh", "/entrypoint/entrypoint.sh"]

View File

@@ -1,10 +1,9 @@
#!/bin/sh #!/bin/sh
/bin/sh /entrypoint/fix_volumes.sh
service mariadb start service mariadb start
# Run the CMD that was passed (or default) # Run the CMD that was passed (or default)
#exec "$@" exec "$@"
tail -f /dev/null tail -f /dev/null

View File

@@ -1,18 +0,0 @@
#!/bin/sh
#mkdir -p /etc/mysql # Creates /etc/php if it doesn't exist
#mkdir -p /var/lib/mysql # Creates /etc/php if it doesn't exist
[ -d "/etc/mysql" ] || mkdir -p /etc/mysql
[ -d "/var/lib/mysql" ] || mkdir -p /var/lib/mysql
if [ ! -f /etc/mysql/my.cnf ]; then
cp -a /tmp/buildtime/etc/mysql/* /etc/mysql/
rm -rf /tmp/buildtime/etc/mysql/
fi
if [ "$(ls -A /var/lib/mysql)" ]; then
cp -a /tmp/buildtime/var/lib/mysql/* /var/lib/mysql #&& rm -rf /tmp/buildtime/var/lib/mysql
fi
chown -R mysql:mysql /var/lib/mysql
chown -R mysql:root /run/mysqld

View File

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

View File

@@ -4,7 +4,7 @@ apt-get update
BUILDTIME_PHP_VER_INST="8.2" 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-fpm \
php$BUILDTIME_PHP_VER_INST-bcmath \ php$BUILDTIME_PHP_VER_INST-bcmath \
php$BUILDTIME_PHP_VER_INST-bz2 \ 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 #!/bin/sh
# To add this repository please do: # 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 curl -sSLo /tmp/debsuryorg-archive-keyring.deb https://packages.sury.org/debsuryorg-archive-keyring.deb
dpkg -i /tmp/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' 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
/bin/sh /entrypoint/container-php-ver-inst.sh
/bin/sh /entrypoint/install-php-versions.sh /bin/sh /entrypoint/install-php-versions.sh
# Run the CMD that was passed (or default) # Run the CMD that was passed (or default)
#exec "$@" exec "$@"
tail -f /dev/null tail -f /dev/null

View File

@@ -1,7 +1,5 @@
#!/bin/sh #!/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 # Start each version listed in PHP_VERSIONS
for version in $PHP_VERSIONS; do for version in $PHP_VERSIONS; do

View File

@@ -3,12 +3,8 @@ FROM debian:bookworm
ARG DEBIAN_FRONTEND=noninteractive ARG DEBIAN_FRONTEND=noninteractive
ARG DEBCONF_NONINTERACTIVE_SEEN=true 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/entrypoint.sh /entrypoint/entrypoint.sh
COPY project/entrypoint/gen-cert.sh /entrypoint/gen-cert.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"] ENTRYPOINT ["/bin/sh", "/entrypoint/entrypoint.sh"]

View File

@@ -2,21 +2,7 @@
/bin/sh /entrypoint/gen-cert.sh /bin/sh /entrypoint/gen-cert.sh
for file in /etc/nginx/sites-available/*.conf; do # Run the CMD that was passed (or default)
ln -s "$file" "/etc/nginx/sites-enabled/" exec "$@"
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
tail -f /dev/null tail -f /dev/null

View File

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