Merge pull request #43 from linuxserver/standard-base

Standard base
This commit is contained in:
Eric Nemchik 2023-02-10 19:25:31 -06:00 committed by GitHub
commit 177d5cbba4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
32 changed files with 222 additions and 176 deletions

View File

@ -0,0 +1,12 @@
name: Comment on invalid interaction
on:
issues:
types:
- labeled
jobs:
add-comment-on-invalid:
if: github.event.label.name == 'invalid'
permissions:
issues: write
uses: linuxserver/github-workflows/.github/workflows/invalid-interaction-helper.yml@v1
secrets: inherit

View File

@ -1,4 +1,6 @@
FROM ghcr.io/linuxserver/baseimage-alpine-nginx:3.14
# syntax=docker/dockerfile:1
FROM ghcr.io/linuxserver/baseimage-alpine-nginx:3.17
# set version label
ARG BUILD_DATE
@ -7,30 +9,34 @@ ARG DISKOVER_RELEASE
LABEL build_version="Linuxserver.io version:- ${VERSION} Build-date:- ${BUILD_DATE}"
LABEL maintainer="alex-phillips"
# environment settings
ENV DISKOVERDIR=/config/diskover.conf.d/diskover/
RUN \
echo "**** install build packages ****" && \
apk add --no-cache --virtual=build-dependencies \
build-base \
gcc \
py3-pip \
python3-dev \
cargo \
composer \
curl \
git \
jq \
nodejs \
npm && \
npm \
python3-dev && \
echo "**** install runtime packages ****" && \
apk add --no-cache \
apk add --no-cache \
libldap \
ncurses \
php7-curl \
php7-ldap \
php7-sqlite3 \
php81-curl \
php81-ldap \
php81-sqlite3 \
py3-requests \
py3-urllib3 \
py3-xxhash \
python3 && \
echo "**** configure php-fpm to pass env vars ****" && \
sed -E -i 's/^;?clear_env ?=.*$/clear_env = no/g' /etc/php81/php-fpm.d/www.conf && \
grep -qxF 'clear_env = no' /etc/php81/php-fpm.d/www.conf || echo 'clear_env = no' >> /etc/php81/php-fpm.d/www.conf && \
echo "env[PATH] = /usr/local/bin:/usr/bin:/bin" >> /etc/php81/php-fpm.conf && \
echo "**** install diskover ****" && \
if [ -z ${DISKOVER_RELEASE+x} ]; then \
DISKOVER_RELEASE=$(curl -sX GET "https://api.github.com/repos/diskoverdata/diskover-community/releases" \
@ -43,17 +49,22 @@ RUN \
/tmp/diskover.tar.gz -C \
/app/ --strip-components=1 && \
cd /app/diskover && \
pip3 install --no-cache-dir -r requirements.txt && \
sed -i 's@;clear_env = no@clear_env = no@' "/etc/php7/php-fpm.d/www.conf" && \
echo "**** overlay-fs workaround ****" && \
mv /app/diskover /app/diskover-tmp && \
mv /app/diskover-web /app/diskover-web-tmp && \
python3 -m ensurepip && \
pip3 install -U --no-cache-dir \
pip \
wheel && \
pip3 install -U --no-cache-dir --find-links https://wheel-index.linuxserver.io/alpine-3.17/ -r requirements.txt && \
echo "**** cleanup ****" && \
apk del --purge \
build-dependencies && \
rm -rf \
/tmp/* \
/root/.cache
$HOME/.cache \
$HOME/.cargo
# add local files
COPY ./root/ /
COPY root/ /
# ports and volumes
EXPOSE 80 443
VOLUME /config

View File

@ -1,4 +1,6 @@
FROM ghcr.io/linuxserver/baseimage-alpine-nginx:arm64v8-3.14
# syntax=docker/dockerfile:1
FROM ghcr.io/linuxserver/baseimage-alpine-nginx:arm64v8-3.17
# set version label
ARG BUILD_DATE
@ -7,30 +9,34 @@ ARG DISKOVER_RELEASE
LABEL build_version="Linuxserver.io version:- ${VERSION} Build-date:- ${BUILD_DATE}"
LABEL maintainer="alex-phillips"
# environment settings
ENV DISKOVERDIR=/config/diskover.conf.d/diskover/
RUN \
echo "**** install build packages ****" && \
apk add --no-cache --virtual=build-dependencies \
build-base \
gcc \
py3-pip \
python3-dev \
cargo \
composer \
curl \
git \
jq \
nodejs \
npm && \
npm \
python3-dev && \
echo "**** install runtime packages ****" && \
apk add --no-cache \
apk add --no-cache \
libldap \
ncurses \
php7-curl \
php7-ldap \
php7-sqlite3 \
php81-curl \
php81-ldap \
php81-sqlite3 \
py3-requests \
py3-urllib3 \
py3-xxhash \
python3 && \
echo "**** configure php-fpm to pass env vars ****" && \
sed -E -i 's/^;?clear_env ?=.*$/clear_env = no/g' /etc/php81/php-fpm.d/www.conf && \
grep -qxF 'clear_env = no' /etc/php81/php-fpm.d/www.conf || echo 'clear_env = no' >> /etc/php81/php-fpm.d/www.conf && \
echo "env[PATH] = /usr/local/bin:/usr/bin:/bin" >> /etc/php81/php-fpm.conf && \
echo "**** install diskover ****" && \
if [ -z ${DISKOVER_RELEASE+x} ]; then \
DISKOVER_RELEASE=$(curl -sX GET "https://api.github.com/repos/diskoverdata/diskover-community/releases" \
@ -43,17 +49,22 @@ RUN \
/tmp/diskover.tar.gz -C \
/app/ --strip-components=1 && \
cd /app/diskover && \
pip3 install --no-cache-dir -r requirements.txt && \
sed -i 's@;clear_env = no@clear_env = no@' "/etc/php7/php-fpm.d/www.conf" && \
echo "**** overlay-fs workaround ****" && \
mv /app/diskover /app/diskover-tmp && \
mv /app/diskover-web /app/diskover-web-tmp && \
python3 -m ensurepip && \
pip3 install -U --no-cache-dir \
pip \
wheel && \
pip3 install -U --no-cache-dir --find-links https://wheel-index.linuxserver.io/alpine-3.17/ -r requirements.txt && \
echo "**** cleanup ****" && \
apk del --purge \
build-dependencies && \
rm -rf \
/tmp/* \
/root/.cache
$HOME/.cache \
$HOME/.cargo
# add local files
COPY ./root/ /
COPY root/ /
# ports and volumes
EXPOSE 80 443
VOLUME /config

View File

@ -1,4 +1,6 @@
FROM ghcr.io/linuxserver/baseimage-alpine-nginx:arm32v7-3.14
# syntax=docker/dockerfile:1
FROM ghcr.io/linuxserver/baseimage-alpine-nginx:arm32v7-3.17
# set version label
ARG BUILD_DATE
@ -7,30 +9,34 @@ ARG DISKOVER_RELEASE
LABEL build_version="Linuxserver.io version:- ${VERSION} Build-date:- ${BUILD_DATE}"
LABEL maintainer="alex-phillips"
# environment settings
ENV DISKOVERDIR=/config/diskover.conf.d/diskover/
RUN \
echo "**** install build packages ****" && \
apk add --no-cache --virtual=build-dependencies \
build-base \
gcc \
py3-pip \
python3-dev \
cargo \
composer \
curl \
git \
jq \
nodejs \
npm && \
npm \
python3-dev && \
echo "**** install runtime packages ****" && \
apk add --no-cache \
apk add --no-cache \
libldap \
ncurses \
php7-curl \
php7-ldap \
php7-sqlite3 \
php81-curl \
php81-ldap \
php81-sqlite3 \
py3-requests \
py3-urllib3 \
py3-xxhash \
python3 && \
echo "**** configure php-fpm to pass env vars ****" && \
sed -E -i 's/^;?clear_env ?=.*$/clear_env = no/g' /etc/php81/php-fpm.d/www.conf && \
grep -qxF 'clear_env = no' /etc/php81/php-fpm.d/www.conf || echo 'clear_env = no' >> /etc/php81/php-fpm.d/www.conf && \
echo "env[PATH] = /usr/local/bin:/usr/bin:/bin" >> /etc/php81/php-fpm.conf && \
echo "**** install diskover ****" && \
if [ -z ${DISKOVER_RELEASE+x} ]; then \
DISKOVER_RELEASE=$(curl -sX GET "https://api.github.com/repos/diskoverdata/diskover-community/releases" \
@ -43,17 +49,22 @@ RUN \
/tmp/diskover.tar.gz -C \
/app/ --strip-components=1 && \
cd /app/diskover && \
pip3 install --no-cache-dir -r requirements.txt && \
sed -i 's@;clear_env = no@clear_env = no@' "/etc/php7/php-fpm.d/www.conf" && \
echo "**** overlay-fs workaround ****" && \
mv /app/diskover /app/diskover-tmp && \
mv /app/diskover-web /app/diskover-web-tmp && \
python3 -m ensurepip && \
pip3 install -U --no-cache-dir \
pip \
wheel && \
pip3 install -U --no-cache-dir --find-links https://wheel-index.linuxserver.io/alpine-3.17/ -r requirements.txt && \
echo "**** cleanup ****" && \
apk del --purge \
build-dependencies && \
rm -rf \
/tmp/* \
/root/.cache
$HOME/.cache \
$HOME/.cargo
# add local files
COPY ./root/ /
COPY root/ /
# ports and volumes
EXPOSE 80 443
VOLUME /config

8
Jenkinsfile vendored
View File

@ -30,12 +30,12 @@ pipeline {
DIST_IMAGE = 'alpine'
MULTIARCH='true'
CI='true'
CI_WEB='false'
CI_PORT=''
CI_SSL=''
CI_WEB='true'
CI_PORT='80'
CI_SSL='false'
CI_DELAY='120'
CI_DOCKERENV='TZ=US/Pacific'
CI_AUTH=''
CI_AUTH='user:password'
CI_WEBPATH=''
}
stages {

View File

@ -271,6 +271,7 @@ Once registered you can define the dockerfile to use with `-f Dockerfile.aarch64
## Versions
* **20.08.22:** - Rebasing to alpine 3.17 with php8.1. Restructure nginx configs ([see changes announcement](https://info.linuxserver.io/issues/2022-08-20-nginx-base)).
* **25.02.22:** - Add php7-sqlite3 to support rc4 release.
* **03.11.21:** - Added more support for potential config files.
* **31.10.21:** - Added xpack.security variable to ElasticSearch; added instructions to edit Constants.php in diskover; corrected command needed to manually generate an index in diskover

View File

@ -20,10 +20,10 @@ repo_vars:
- DIST_IMAGE = 'alpine'
- MULTIARCH='true'
- CI='true'
- CI_WEB='false'
- CI_PORT=''
- CI_SSL=''
- CI_WEB='true'
- CI_PORT='80'
- CI_SSL='false'
- CI_DELAY='120'
- CI_DOCKERENV='TZ=US/Pacific'
- CI_AUTH=''
- CI_AUTH='user:password'
- CI_WEBPATH=''

View File

@ -94,6 +94,7 @@ app_setup_block: |
# changelog
changelogs:
- { date: "20.08.22:", desc: "Rebasing to alpine 3.17 with php8.1. Restructure nginx configs ([see changes announcement](https://info.linuxserver.io/issues/2022-08-20-nginx-base))." }
- { date: "25.02.22:", desc: "Add php7-sqlite3 to support rc4 release." }
- { date: "03.11.21:", desc: "Added more support for potential config files." }
- { date: "31.10.21:", desc: "Added xpack.security variable to ElasticSearch; added instructions to edit Constants.php in diskover; corrected command needed to manually generate an index in diskover" }

View File

@ -1 +0,0 @@
#0 3 * * * python3 /app/diskover/diskover.py /data

View File

@ -1,38 +0,0 @@
server {
listen 80 default_server;
listen 443 ssl;
root /app/www/public;
index index.php index.html index.htm;
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.php?$query_string;
}
# # unless the request is for a valid file (image, js, css, etc.), send to bootstrap
# if (!-e $request_filename)
# {
# rewrite ^/(.*)$ /index.php?/$1 last;
# break;
# }
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include /etc/nginx/fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_intercept_errors off;
fastcgi_buffer_size 16k;
fastcgi_buffers 4 16k;
fastcgi_read_timeout 300;
}
}

View File

@ -0,0 +1,34 @@
## Version 2023/01/23 - Changelog: https://github.com/linuxserver/docker-diskover/commits/master/root/defaults/nginx/site-confs/default.conf.sample
server {
listen 80 default_server;
listen [::]:80 default_server;
listen 443 ssl http2 default_server;
listen [::]:443 ssl http2 default_server;
server_name _;
root /app/diskover-web/public;
index index.html index.htm index.php;
location / {
# enable for basic auth
#auth_basic "Restricted";
#auth_basic_user_file /config/nginx/.htpasswd;
try_files $uri $uri/ /index.php$is_args$args;
}
location ~ ^(.+\.php)(.*)$ {
fastcgi_split_path_info ^(.+\.php)(.*)$;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include /etc/nginx/fastcgi_params;
}
# deny access to .htaccess/.htpasswd files
location ~ /\.ht {
deny all;
}
}

View File

@ -1,13 +0,0 @@
#!/usr/bin/with-contenv bash
if [ -d "/app/diskover-tmp" ]; then
echo "New container detected. Setting up app folder and fixing permissions."
mv /app/diskover-tmp /app/diskover
fi
if [ -d "/app/diskover-web-tmp" ]; then
mv /app/diskover-web-tmp /app/www
fi
chown -R abc:abc /app

View File

@ -1,18 +0,0 @@
#!/usr/bin/with-contenv bash
# copy config
if [[ ! -e /config/diskover.conf.d ]]; then
cp -r /app/diskover/configs_sample /config/diskover.conf.d
fi
ls /config/diskover.conf.d | \
xargs -I {} \
ln -sf /config/diskover.conf.d/{} /etc/{}
# install crontab
[[ ! -e "/config/crontab" ]] && \
cp /defaults/crontabs/abc /config/crontab
crontab -u abc /config/crontab
chown -R abc:abc /config

View File

@ -1,39 +0,0 @@
#!/usr/bin/with-contenv bash
mkdir -p \
/config/diskover-web.conf.d
# copy over sample config files
cd /app/www/public
for file in *.sample; do
dest=${file%.sample}
[[ ! -e "/config/diskover-web.conf.d/$dest" ]] && \
cp /app/www/public/$file /config/diskover-web.conf.d/$dest
ln -sf /config/diskover-web.conf.d/$dest /app/www/public/$dest
done
cd /app/www/public/tasks
for file in *.sample; do
dest=${file%.sample}
[[ ! -e "/config/diskover-web.conf.d/$dest" ]] && \
cp /app/www/public/tasks/$file /config/diskover-web.conf.d/$dest
ln -sf /config/diskover-web.conf.d/$dest /app/www/public/tasks/$dest
done
if [[ ! -e "/config/diskoverdb.sqlite3" ]]; then
touch /config/diskoverdb.sqlite3
fi
ln -sf /config/diskoverdb.sqlite3 /app/www/diskoverdb.sqlite3
# copy and set variables in Constants.php
if [[ ! -e "/config/diskover-web.conf.d/Constants.php" ]]; then
cp /app/www/src/diskover/Constants.php.sample /config/diskover-web.conf.d/Constants.php
fi
ln -sf /config/diskover-web.conf.d/Constants.php /app/www/src/diskover/Constants.php
chown -R abc:abc /config

1
root/etc/crontabs/abc Normal file
View File

@ -0,0 +1 @@
#0 3 * * * python3 /app/diskover/diskover.py -i diskover-my_index_name /data

View File

@ -0,0 +1,21 @@
#!/usr/bin/with-contenv bash
# shellcheck shell=bash
# make crontab config folder
mkdir -p \
/config/crontabs
# if abc crontabs do not exist in config
# copy abc crontab from system
if [[ ! -f /config/crontabs/abc ]] && crontab -l -u abc; then
crontab -l -u abc >/config/crontabs/abc
fi
# if abc crontabs still do not exist in config (were not copied from system)
# copy abc crontab from included defaults
if [[ ! -f /config/crontabs/abc ]]; then
cp /etc/crontabs/abc /config/crontabs/
fi
# import user crontabs
crontab -u abc /config/crontabs/abc

View File

@ -0,0 +1 @@
oneshot

View File

@ -0,0 +1 @@
/etc/s6-overlay/s6-rc.d/init-crontabs-config/run

View File

@ -0,0 +1,49 @@
#!/usr/bin/with-contenv bash
# shellcheck shell=bash
# copy config
if [[ ! -e /config/diskover.conf.d ]]; then
cp -r /app/diskover/configs_sample /config/diskover.conf.d
fi
# setup web
mkdir -p \
/config/diskover-web.conf.d
# copy over sample config files
if [[ -d /app/diskover-web/public ]]; then
cd /app/diskover-web/public || exit 1
for file in *.sample; do
dest=${file%.sample}
if [[ ! -e "/config/diskover-web.conf.d/$dest" ]]; then
cp "/app/diskover-web/public/$file" "/config/diskover-web.conf.d/$dest"
fi
ln -sf "/config/diskover-web.conf.d/$dest" "/app/diskover-web/public/$dest"
done
fi
if [[ -d /app/diskover-web/public/tasks ]]; then
cd /app/diskover-web/public/tasks || exit 1
for file in *.sample; do
dest=${file%.sample}
if [[ ! -e "/config/diskover-web.conf.d/$dest" ]]; then
cp "/app/diskover-web/public/tasks/$file" "/config/diskover-web.conf.d/$dest"
fi
ln -sf "/config/diskover-web.conf.d/$dest" "/app/diskover-web/public/tasks/$dest"
done
fi
# touch db
if [[ ! -e "/config/diskoverdb.sqlite3" ]]; then
touch /config/diskoverdb.sqlite3
fi
ln -sf /config/diskoverdb.sqlite3 /app/diskover-web/diskoverdb.sqlite3
# copy and set variables in Constants.php
if [[ ! -e "/config/diskover-web.conf.d/Constants.php" ]]; then
cp /app/diskover-web/src/diskover/Constants.php.sample /config/diskover-web.conf.d/Constants.php
fi
ln -sf /config/diskover-web.conf.d/Constants.php /app/diskover-web/src/diskover/Constants.php
lsiown -R abc:abc /config

View File

@ -0,0 +1 @@
oneshot

View File

@ -0,0 +1 @@
/etc/s6-overlay/s6-rc.d/init-diskover-config/run

View File

@ -1,4 +1,5 @@
#!/usr/bin/with-contenv bash
# shellcheck shell=bash
if [ -f "/config/diskover.cfg" ]; then
echo '
@ -23,8 +24,7 @@ if [ -f "/config/diskover.cfg" ]; then
* *
******************************************************
******************************************************'
while true
do
while true; do
sleep 3600
done
fi

View File

@ -0,0 +1 @@
oneshot

View File

@ -0,0 +1 @@
/etc/s6-overlay/s6-rc.d/init-eol-check/run

View File

@ -1,3 +0,0 @@
#!/usr/bin/with-contenv bash
exec /usr/sbin/crond -f -S -l 5 -c /etc/crontabs