Merge pull request #15 from linuxserver/standard-base

Standard base
This commit is contained in:
Eric Nemchik 2022-08-23 16:52:49 -05:00 committed by GitHub
commit 2a85eb3983
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 171 additions and 148 deletions

View File

@ -1,4 +1,4 @@
FROM ghcr.io/linuxserver/baseimage-alpine-nginx:3.13
FROM ghcr.io/linuxserver/baseimage-alpine-nginx:3.15
# set version label
ARG BUILD_DATE
@ -8,34 +8,34 @@ LABEL build_version="Linuxserver.io version:- ${VERSION} Build-date:- ${BUILD_DA
LABEL maintainer="aptalca"
RUN \
echo "**** install packages ****" && \
apk add --no-cache \
curl \
php7-ctype \
php7-gd \
php7-mysqli \
php7-pdo_pgsql \
php7-pdo_sqlite && \
echo "**** install librespeed ****" && \
if [ -z ${LIBRESPEED_RELEASE+x} ]; then \
LIBRESPEED_RELEASE=$(curl -sX GET "https://api.github.com/repos/librespeed/speedtest/releases/latest" \
| awk '/tag_name/{print $4;exit}' FS='[""]'); \
fi && \
mkdir -p \
/usr/share/webapps/librespeed && \
curl -o \
/tmp/librespeed.tar.gz -L \
"https://github.com/librespeed/speedtest/archive/${LIBRESPEED_RELEASE}.tar.gz" && \
tar xf \
/tmp/librespeed.tar.gz -C \
/usr/share/webapps/librespeed --strip-components=1 && \
echo "**** cleanup ****" && \
rm -rf \
/tmp/*
echo "**** install packages ****" && \
apk add --no-cache \
curl \
php8-ctype \
php8-gd \
php8-mysqli \
php8-pdo_pgsql \
php8-pdo_sqlite && \
echo "**** install librespeed ****" && \
if [ -z ${LIBRESPEED_RELEASE+x} ]; then \
LIBRESPEED_RELEASE=$(curl -sX GET "https://api.github.com/repos/librespeed/speedtest/releases/latest" \
| awk '/tag_name/{print $4;exit}' FS='[""]'); \
fi && \
mkdir -p \
/app/www/public && \
curl -o \
/tmp/librespeed.tar.gz -L \
"https://github.com/librespeed/speedtest/archive/${LIBRESPEED_RELEASE}.tar.gz" && \
tar xf \
/tmp/librespeed.tar.gz -C \
/app/www/public --strip-components=1 && \
echo "**** cleanup ****" && \
rm -rf \
/tmp/*
# add local files
COPY root/ /
# ports and volumes
EXPOSE 80
EXPOSE 80 443
VOLUME /config

View File

@ -1,4 +1,4 @@
FROM ghcr.io/linuxserver/baseimage-alpine-nginx:arm64v8-3.13
FROM ghcr.io/linuxserver/baseimage-alpine-nginx:arm64v8-3.15
# set version label
ARG BUILD_DATE
@ -8,34 +8,34 @@ LABEL build_version="Linuxserver.io version:- ${VERSION} Build-date:- ${BUILD_DA
LABEL maintainer="aptalca"
RUN \
echo "**** install packages ****" && \
apk add --no-cache \
curl \
php7-ctype \
php7-gd \
php7-mysqli \
php7-pdo_pgsql \
php7-pdo_sqlite && \
echo "**** install librespeed ****" && \
if [ -z ${LIBRESPEED_RELEASE+x} ]; then \
LIBRESPEED_RELEASE=$(curl -sX GET "https://api.github.com/repos/librespeed/speedtest/releases/latest" \
| awk '/tag_name/{print $4;exit}' FS='[""]'); \
fi && \
mkdir -p \
/usr/share/webapps/librespeed && \
curl -o \
/tmp/librespeed.tar.gz -L \
"https://github.com/librespeed/speedtest/archive/${LIBRESPEED_RELEASE}.tar.gz" && \
tar xf \
/tmp/librespeed.tar.gz -C \
/usr/share/webapps/librespeed --strip-components=1 && \
echo "**** cleanup ****" && \
rm -rf \
/tmp/*
echo "**** install packages ****" && \
apk add --no-cache \
curl \
php8-ctype \
php8-gd \
php8-mysqli \
php8-pdo_pgsql \
php8-pdo_sqlite && \
echo "**** install librespeed ****" && \
if [ -z ${LIBRESPEED_RELEASE+x} ]; then \
LIBRESPEED_RELEASE=$(curl -sX GET "https://api.github.com/repos/librespeed/speedtest/releases/latest" \
| awk '/tag_name/{print $4;exit}' FS='[""]'); \
fi && \
mkdir -p \
/app/www/public && \
curl -o \
/tmp/librespeed.tar.gz -L \
"https://github.com/librespeed/speedtest/archive/${LIBRESPEED_RELEASE}.tar.gz" && \
tar xf \
/tmp/librespeed.tar.gz -C \
/app/www/public --strip-components=1 && \
echo "**** cleanup ****" && \
rm -rf \
/tmp/*
# add local files
COPY root/ /
# ports and volumes
EXPOSE 80
EXPOSE 80 443
VOLUME /config

View File

@ -1,4 +1,4 @@
FROM ghcr.io/linuxserver/baseimage-alpine-nginx:arm32v7-3.13
FROM ghcr.io/linuxserver/baseimage-alpine-nginx:arm32v7-3.15
# set version label
ARG BUILD_DATE
@ -8,34 +8,34 @@ LABEL build_version="Linuxserver.io version:- ${VERSION} Build-date:- ${BUILD_DA
LABEL maintainer="aptalca"
RUN \
echo "**** install packages ****" && \
apk add --no-cache \
curl \
php7-ctype \
php7-gd \
php7-mysqli \
php7-pdo_pgsql \
php7-pdo_sqlite && \
echo "**** install librespeed ****" && \
if [ -z ${LIBRESPEED_RELEASE+x} ]; then \
LIBRESPEED_RELEASE=$(curl -sX GET "https://api.github.com/repos/librespeed/speedtest/releases/latest" \
| awk '/tag_name/{print $4;exit}' FS='[""]'); \
fi && \
mkdir -p \
/usr/share/webapps/librespeed && \
curl -o \
/tmp/librespeed.tar.gz -L \
"https://github.com/librespeed/speedtest/archive/${LIBRESPEED_RELEASE}.tar.gz" && \
tar xf \
/tmp/librespeed.tar.gz -C \
/usr/share/webapps/librespeed --strip-components=1 && \
echo "**** cleanup ****" && \
rm -rf \
/tmp/*
echo "**** install packages ****" && \
apk add --no-cache \
curl \
php8-ctype \
php8-gd \
php8-mysqli \
php8-pdo_pgsql \
php8-pdo_sqlite && \
echo "**** install librespeed ****" && \
if [ -z ${LIBRESPEED_RELEASE+x} ]; then \
LIBRESPEED_RELEASE=$(curl -sX GET "https://api.github.com/repos/librespeed/speedtest/releases/latest" \
| awk '/tag_name/{print $4;exit}' FS='[""]'); \
fi && \
mkdir -p \
/app/www/public && \
curl -o \
/tmp/librespeed.tar.gz -L \
"https://github.com/librespeed/speedtest/archive/${LIBRESPEED_RELEASE}.tar.gz" && \
tar xf \
/tmp/librespeed.tar.gz -C \
/app/www/public --strip-components=1 && \
echo "**** cleanup ****" && \
rm -rf \
/tmp/*
# add local files
COPY root/ /
# ports and volumes
EXPOSE 80
EXPOSE 80 443
VOLUME /config

View File

@ -254,6 +254,7 @@ Once registered you can define the dockerfile to use with `-f Dockerfile.aarch64
## Versions
* **20.08.22:** - Rebasing to alpine 3.15 with php8. Restructure nginx configs ([see changes announcement](https://info.linuxserver.io/issues/2022-08-20-nginx-base)).
* **01.03.21:** - Fix up database settings. Make sure `index.html` is recreated.
* **28.02.21:** - Added php7-ctype.
* **23.01.21:** - Rebasing to alpine 3.13.

View File

@ -63,6 +63,7 @@ app_setup_block: |
# changelog
changelogs:
- { date: "20.08.22:", desc: "Rebasing to alpine 3.15 with php8. Restructure nginx configs ([see changes announcement](https://info.linuxserver.io/issues/2022-08-20-nginx-base))." }
- { date: "01.03.21:", desc: "Fix up database settings. Make sure `index.html` is recreated." }
- { date: "28.02.21:", desc: "Added php7-ctype." }
- { date: "23.01.21:", desc: "Rebasing to alpine 3.13." }

View File

@ -1,31 +0,0 @@
## Version 2020/01/06 - Changelog: https://github.com/linuxserver/docker-librespeed/commits/master/root/defaults/default
server {
listen 80 default_server;
listen 443 ssl;
root /usr/share/webapps/librespeed;
index index.php index.html index.htm;
real_ip_header X-Forwarded-For;
set_real_ip_from 172.17.0.0/16;
server_name _;
ssl_certificate /config/keys/cert.crt;
ssl_certificate_key /config/keys/cert.key;
client_max_body_size 0;
location / {
try_files $uri $uri/ /index.html;
}
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include /etc/nginx/fastcgi_params;
}
}

View File

@ -2,63 +2,65 @@
# make our folders
mkdir -p \
/config/www \
/config/www/img
/config/www \
/config/www/img
# create symlink to index.html
[[ ! -L /usr/share/webapps/librespeed/index.html ]] && \
ln -s /config/www/index.html /usr/share/webapps/librespeed/index.html
[[ ! -f /config/www/index.html ]] && \
cp /defaults/index.html /config/www/index.html
if [[ ! -L /app/www/public/index.html ]]; then
ln -s /config/www/index.html /app/www/public/index.html
fi
# update templates
cp /usr/share/webapps/librespeed/example*.html /config/www/
cp /app/www/public/example*.html /config/www/
# use custom js files if exist
[[ -f /config/www/speedtest.js ]] && \
cp /config/www/speedtest.js /usr/share/webapps/librespeed/speedtest.js
[[ -f /config/www/speedtest_worker.js ]] && \
cp /config/www/speedtest_worker.js /usr/share/webapps/librespeed/speedtest_worker.js
if [[ -f /config/www/speedtest.js ]]; then
cp /config/www/speedtest.js /app/www/public/speedtest.js
fi
if [[ -f /config/www/speedtest_worker.js ]]; then
cp /config/www/speedtest_worker.js /app/www/public/speedtest_worker.js
fi
# enables custom results page
if [ "$CUSTOM_RESULTS" == "true" ]; then
echo "custom results"
[[ ! -e "/config/www/results/index.php" ]] && \
mkdir -p /config/www/results/ && \
mv /usr/share/webapps/librespeed/results/index.php /config/www/results/index.php
ln -sf /config/www/results/index.php /usr/share/webapps/librespeed/results/index.php
echo "custom results"
if [[ ! -e "/config/www/results/index.php" ]]; then
mkdir -p /config/www/results/
mv /app/www/public/results/index.php /config/www/results/index.php
fi
ln -sf /config/www/results/index.php /app/www/public/results/index.php
fi
# configure app settings
sed -i "\
s|\$Sqlite_db_file.*|\$Sqlite_db_file = \'/config/speedtest_telemetry.sql\';|g; \
s|\$enable_id_obfuscation.*|\$enable_id_obfuscation = true;|g;
s|\$stats_password.*|\$stats_password = \'${PASSWORD}\';|g" \
/usr/share/webapps/librespeed/results/telemetry_settings.php
s|\$Sqlite_db_file.*|\$Sqlite_db_file = \'/config/speedtest_telemetry.sql\';|g; \
s|\$enable_id_obfuscation.*|\$enable_id_obfuscation = true;|g;
s|\$stats_password.*|\$stats_password = \'${PASSWORD}\';|g" \
/app/www/public/results/telemetry_settings.php
if [ "$DB_TYPE" = "postgresql" ]; then
sed -i "\
s|\$db_type.*|\$db_type = \'${DB_TYPE}\';|g; \
s|\$PostgreSql_username.*|\$PostgreSql_username = \'${DB_USERNAME}\';|g; \
s|\$PostgreSql_password.*|\$PostgreSql_password = \'${DB_PASSWORD}\';|g; \
s|\$PostgreSql_hostname.*|\$PostgreSql_hostname = \'${DB_HOSTNAME}\';|g; \
s|\$PostgreSql_databasename.*|\$PostgreSql_databasename = \'${DB_NAME}\';|g" \
/usr/share/webapps/librespeed/results/telemetry_settings.php
sed -i "\
s|\$db_type.*|\$db_type = \'${DB_TYPE}\';|g; \
s|\$PostgreSql_username.*|\$PostgreSql_username = \'${DB_USERNAME}\';|g; \
s|\$PostgreSql_password.*|\$PostgreSql_password = \'${DB_PASSWORD}\';|g; \
s|\$PostgreSql_hostname.*|\$PostgreSql_hostname = \'${DB_HOSTNAME}\';|g; \
s|\$PostgreSql_databasename.*|\$PostgreSql_databasename = \'${DB_NAME}\';|g" \
/app/www/public/results/telemetry_settings.php
elif [ "$DB_TYPE" = "mysql" ]; then
sed -i "\
s|\$MySql_username.*|\$MySql_username = \'${DB_USERNAME}\';|g; \
s|\$MySql_password.*|\$MySql_password = \'${DB_PASSWORD}\';|g; \
s|\$MySql_hostname.*|\$MySql_hostname = \'${DB_HOSTNAME}\';|g; \
s|\$MySql_databasename.*|\$MySql_databasename = \'${DB_NAME}\';|g; \
s|\$MySql_port.*|\$MySql_port = \'${DB_PORT:-3306}\';|g" \
/usr/share/webapps/librespeed/results/telemetry_settings.php
sed -i "\
s|\$MySql_username.*|\$MySql_username = \'${DB_USERNAME}\';|g; \
s|\$MySql_password.*|\$MySql_password = \'${DB_PASSWORD}\';|g; \
s|\$MySql_hostname.*|\$MySql_hostname = \'${DB_HOSTNAME}\';|g; \
s|\$MySql_databasename.*|\$MySql_databasename = \'${DB_NAME}\';|g; \
s|\$MySql_port.*|\$MySql_port = \'${DB_PORT:-3306}\';|g" \
/app/www/public/results/telemetry_settings.php
else
sed -i \
"s|\$db_type.*|\$db_type = \'sqlite\';|g" \
/usr/share/webapps/librespeed/results/telemetry_settings.php
sed -i \
"s|\$db_type.*|\$db_type = \'sqlite\';|g" \
/app/www/public/results/telemetry_settings.php
fi
# permissions
echo "Setting permissions"
chown -R abc:abc \
/usr/share/webapps/librespeed \
/config
/app/www/public \
/config

View File

@ -0,0 +1,10 @@
#!/usr/bin/with-contenv bash
DEFAULT_CONF="/config/nginx/site-confs/default.conf"
OLD_ROOT="root /usr/share/webapps/librespeed;"
NEW_ROOT="root /app/www/public;"
if grep -q "${OLD_ROOT}" "${DEFAULT_CONF}";then
echo "updating root in ${DEFAULT_CONF}"
sed -i "s|${OLD_ROOT}|${NEW_ROOT}|" "${DEFAULT_CONF}"
fi

View File

@ -0,0 +1,40 @@
<html>
<head>
<title>Upgrade Required!</title>
<style>
body{
font-family: Helvetica, Arial, sans-serif;
}
.message{
width:440px;
padding:20px 40px;
margin:0 auto;
background-color:#f9f9f9;
border:1px solid #ddd;
color: #1e3d62;
}
center{
margin:40px 0;
}
h1{
font-size: 18px;
line-height: 26px;
}
p{
font-size: 12px;
}
a{
color: rgb(207, 48, 139);
}
</style>
</head>
<body>
<div class="message">
<h1>Upgrade Required!</h1>
<p>The application inside this image has been moved to a new folder.</p>
<p>You will need to update your <strong>/config/nginx/nginx.conf</strong> and <strong>/config/nginx/site-confs/default.conf</strong> in order for the application to work.</p>
<p>New config samples are located at <strong>/config/nginx/nginx.conf.sample</strong> and <strong>/config/nginx/site-confs/default.conf.sample</strong></p>
<p>Please review our announcement: <a target="_blank" href="https://info.linuxserver.io/issues/2022-08-20-nginx-base/">Significant changes to nginx based images</a></p>
</div>
</body>
</html>