mirror of
https://github.com/linuxserver/docker-cops.git
synced 2026-02-19 18:51:05 +08:00
commit
09ef7f2d3e
95
Dockerfile
95
Dockerfile
@ -1,4 +1,4 @@
|
||||
FROM ghcr.io/linuxserver/baseimage-alpine-nginx:3.12
|
||||
FROM ghcr.io/linuxserver/baseimage-alpine-nginx:3.15
|
||||
|
||||
# set version label
|
||||
ARG BUILD_DATE
|
||||
@ -8,55 +8,54 @@ LABEL build_version="Linuxserver.io version:- ${VERSION} Build-date:- ${BUILD_DA
|
||||
LABEL maintainer="chbmb"
|
||||
|
||||
RUN \
|
||||
echo "**** install build packages ****" && \
|
||||
apk add --no-cache --upgrade --virtual=build-dependencies \
|
||||
curl \
|
||||
tar && \
|
||||
echo "**** install runtime packages ****" && \
|
||||
apk add --no-cache --upgrade \
|
||||
php7-ctype \
|
||||
php7-dom \
|
||||
php7-gd \
|
||||
php7-intl \
|
||||
php7-mbstring \
|
||||
php7-opcache \
|
||||
php7-openssl \
|
||||
php7-phar \
|
||||
php7-pdo_sqlite \
|
||||
php7-zip \
|
||||
php7-zlib && \
|
||||
echo "**** install composer ****" && \
|
||||
ln -sf /usr/bin/php7 /usr/bin/php && \
|
||||
curl \
|
||||
-sS https://getcomposer.org/installer \
|
||||
| php -- --install-dir=/usr/bin --filename=composer --version=1.10.17 && \
|
||||
composer \
|
||||
global require "fxp/composer-asset-plugin:~1.1" && \
|
||||
echo "**** install cops ****" && \
|
||||
if [ -z ${COPS_RELEASE+x} ]; then \
|
||||
COPS_RELEASE=$(curl -sX GET "https://api.github.com/repos/seblucas/cops/releases/latest" \
|
||||
| awk '/tag_name/{print $4;exit}' FS='[""]'); \
|
||||
fi && \
|
||||
curl -o \
|
||||
/tmp/cops.tar.gz -L \
|
||||
"https://github.com/seblucas/cops/archive/${COPS_RELEASE}.tar.gz" && \
|
||||
mkdir -p \
|
||||
/usr/share/webapps/cops && \
|
||||
tar xf /tmp/cops.tar.gz -C \
|
||||
/usr/share/webapps/cops --strip-components=1 && \
|
||||
cd /usr/share/webapps/cops && \
|
||||
composer \
|
||||
install --no-dev --optimize-autoloader && \
|
||||
echo "**** cleanup ****" && \
|
||||
apk del --purge \
|
||||
build-dependencies && \
|
||||
rm -rf \
|
||||
/root/.composer \
|
||||
/tmp/*
|
||||
echo "**** install build packages ****" && \
|
||||
apk add --no-cache --upgrade --virtual=build-dependencies \
|
||||
curl \
|
||||
tar && \
|
||||
echo "**** install runtime packages ****" && \
|
||||
apk add --no-cache --upgrade \
|
||||
php8-ctype \
|
||||
php8-dom \
|
||||
php8-gd \
|
||||
php8-intl \
|
||||
php8-mbstring \
|
||||
php8-opcache \
|
||||
php8-openssl \
|
||||
php8-phar \
|
||||
php8-pdo_sqlite \
|
||||
php8-zip \
|
||||
php8-zlib && \
|
||||
echo "**** install cops ****" && \
|
||||
curl \
|
||||
-sS https://getcomposer.org/installer \
|
||||
| php -- --install-dir=/usr/bin --filename=composer --version=1.10.26 && \
|
||||
composer \
|
||||
global require "fxp/composer-asset-plugin:~1.1" && \
|
||||
if [ -z ${COPS_RELEASE+x} ]; then \
|
||||
COPS_RELEASE=$(curl -sX GET "https://api.github.com/repos/seblucas/cops/releases/latest" \
|
||||
| awk '/tag_name/{print $4;exit}' FS='[""]'); \
|
||||
fi && \
|
||||
curl -o \
|
||||
/tmp/cops.tar.gz -L \
|
||||
"https://github.com/seblucas/cops/archive/${COPS_RELEASE}.tar.gz" && \
|
||||
mkdir -p \
|
||||
/app/www/public && \
|
||||
tar xf /tmp/cops.tar.gz -C \
|
||||
/app/www/public --strip-components=1 && \
|
||||
cd /app/www/public && \
|
||||
composer \
|
||||
install --no-dev --optimize-autoloader && \
|
||||
sed -i 's|^[[:space:]]*return[[:space:]]@create_function[[:space:]]'\(''\''\$it'\'',[[:space:]]\$func'\)';| return function \(\$it\) use \(\$func\) \{\n return eval\(\$func\);\n \};|' vendor/seblucas/dot-php/doT.php && \
|
||||
echo "**** cleanup ****" && \
|
||||
apk del --purge \
|
||||
build-dependencies && \
|
||||
rm -rf \
|
||||
/root/.composer \
|
||||
/tmp/*
|
||||
|
||||
# add local files
|
||||
COPY root/ /
|
||||
|
||||
# ports and volumes
|
||||
EXPOSE 80
|
||||
VOLUME /config /books
|
||||
EXPOSE 80 443
|
||||
VOLUME /config
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
FROM ghcr.io/linuxserver/baseimage-alpine-nginx:arm64v8-3.12
|
||||
FROM ghcr.io/linuxserver/baseimage-alpine-nginx:arm64v8-3.15
|
||||
|
||||
# set version label
|
||||
ARG BUILD_DATE
|
||||
@ -8,55 +8,54 @@ LABEL build_version="Linuxserver.io version:- ${VERSION} Build-date:- ${BUILD_DA
|
||||
LABEL maintainer="chbmb"
|
||||
|
||||
RUN \
|
||||
echo "**** install build packages ****" && \
|
||||
apk add --no-cache --upgrade --virtual=build-dependencies \
|
||||
curl \
|
||||
tar && \
|
||||
echo "**** install runtime packages ****" && \
|
||||
apk add --no-cache --upgrade \
|
||||
php7-ctype \
|
||||
php7-dom \
|
||||
php7-gd \
|
||||
php7-intl \
|
||||
php7-mbstring \
|
||||
php7-opcache \
|
||||
php7-openssl \
|
||||
php7-phar \
|
||||
php7-pdo_sqlite \
|
||||
php7-zip \
|
||||
php7-zlib && \
|
||||
echo "**** install composer ****" && \
|
||||
ln -sf /usr/bin/php7 /usr/bin/php && \
|
||||
curl \
|
||||
-sS https://getcomposer.org/installer \
|
||||
| php -- --install-dir=/usr/bin --filename=composer --version=1.10.17 && \
|
||||
composer \
|
||||
global require "fxp/composer-asset-plugin:~1.1" && \
|
||||
echo "**** install cops ****" && \
|
||||
if [ -z ${COPS_RELEASE+x} ]; then \
|
||||
COPS_RELEASE=$(curl -sX GET "https://api.github.com/repos/seblucas/cops/releases/latest" \
|
||||
| awk '/tag_name/{print $4;exit}' FS='[""]'); \
|
||||
fi && \
|
||||
curl -o \
|
||||
/tmp/cops.tar.gz -L \
|
||||
"https://github.com/seblucas/cops/archive/${COPS_RELEASE}.tar.gz" && \
|
||||
mkdir -p \
|
||||
/usr/share/webapps/cops && \
|
||||
tar xf /tmp/cops.tar.gz -C \
|
||||
/usr/share/webapps/cops --strip-components=1 && \
|
||||
cd /usr/share/webapps/cops && \
|
||||
composer \
|
||||
install --no-dev --optimize-autoloader && \
|
||||
echo "**** cleanup ****" && \
|
||||
apk del --purge \
|
||||
build-dependencies && \
|
||||
rm -rf \
|
||||
/root/.composer \
|
||||
/tmp/*
|
||||
echo "**** install build packages ****" && \
|
||||
apk add --no-cache --upgrade --virtual=build-dependencies \
|
||||
curl \
|
||||
tar && \
|
||||
echo "**** install runtime packages ****" && \
|
||||
apk add --no-cache --upgrade \
|
||||
php8-ctype \
|
||||
php8-dom \
|
||||
php8-gd \
|
||||
php8-intl \
|
||||
php8-mbstring \
|
||||
php8-opcache \
|
||||
php8-openssl \
|
||||
php8-phar \
|
||||
php8-pdo_sqlite \
|
||||
php8-zip \
|
||||
php8-zlib && \
|
||||
echo "**** install cops ****" && \
|
||||
curl \
|
||||
-sS https://getcomposer.org/installer \
|
||||
| php -- --install-dir=/usr/bin --filename=composer --version=1.10.26 && \
|
||||
composer \
|
||||
global require "fxp/composer-asset-plugin:~1.1" && \
|
||||
if [ -z ${COPS_RELEASE+x} ]; then \
|
||||
COPS_RELEASE=$(curl -sX GET "https://api.github.com/repos/seblucas/cops/releases/latest" \
|
||||
| awk '/tag_name/{print $4;exit}' FS='[""]'); \
|
||||
fi && \
|
||||
curl -o \
|
||||
/tmp/cops.tar.gz -L \
|
||||
"https://github.com/seblucas/cops/archive/${COPS_RELEASE}.tar.gz" && \
|
||||
mkdir -p \
|
||||
/app/www/public && \
|
||||
tar xf /tmp/cops.tar.gz -C \
|
||||
/app/www/public --strip-components=1 && \
|
||||
cd /app/www/public && \
|
||||
composer \
|
||||
install --no-dev --optimize-autoloader && \
|
||||
sed -i 's|^[[:space:]]*return[[:space:]]@create_function[[:space:]]'\(''\''\$it'\'',[[:space:]]\$func'\)';| return function \(\$it\) use \(\$func\) \{\n return eval\(\$func\);\n \};|' vendor/seblucas/dot-php/doT.php && \
|
||||
echo "**** cleanup ****" && \
|
||||
apk del --purge \
|
||||
build-dependencies && \
|
||||
rm -rf \
|
||||
/root/.composer \
|
||||
/tmp/*
|
||||
|
||||
# add local files
|
||||
COPY root/ /
|
||||
|
||||
# ports and volumes
|
||||
EXPOSE 80
|
||||
VOLUME /config /books
|
||||
EXPOSE 80 443
|
||||
VOLUME /config
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
FROM ghcr.io/linuxserver/baseimage-alpine-nginx:arm32v7-3.12
|
||||
FROM ghcr.io/linuxserver/baseimage-alpine-nginx:arm32v7-3.15
|
||||
|
||||
# set version label
|
||||
ARG BUILD_DATE
|
||||
@ -8,55 +8,54 @@ LABEL build_version="Linuxserver.io version:- ${VERSION} Build-date:- ${BUILD_DA
|
||||
LABEL maintainer="chbmb"
|
||||
|
||||
RUN \
|
||||
echo "**** install build packages ****" && \
|
||||
apk add --no-cache --upgrade --virtual=build-dependencies \
|
||||
curl \
|
||||
tar && \
|
||||
echo "**** install runtime packages ****" && \
|
||||
apk add --no-cache --upgrade \
|
||||
php7-ctype \
|
||||
php7-dom \
|
||||
php7-gd \
|
||||
php7-intl \
|
||||
php7-mbstring \
|
||||
php7-opcache \
|
||||
php7-openssl \
|
||||
php7-phar \
|
||||
php7-pdo_sqlite \
|
||||
php7-zip \
|
||||
php7-zlib && \
|
||||
echo "**** install composer ****" && \
|
||||
ln -sf /usr/bin/php7 /usr/bin/php && \
|
||||
curl \
|
||||
-sS https://getcomposer.org/installer \
|
||||
| php -- --install-dir=/usr/bin --filename=composer --version=1.10.17 && \
|
||||
composer \
|
||||
global require "fxp/composer-asset-plugin:~1.1" && \
|
||||
echo "**** install cops ****" && \
|
||||
if [ -z ${COPS_RELEASE+x} ]; then \
|
||||
COPS_RELEASE=$(curl -sX GET "https://api.github.com/repos/seblucas/cops/releases/latest" \
|
||||
| awk '/tag_name/{print $4;exit}' FS='[""]'); \
|
||||
fi && \
|
||||
curl -o \
|
||||
/tmp/cops.tar.gz -L \
|
||||
"https://github.com/seblucas/cops/archive/${COPS_RELEASE}.tar.gz" && \
|
||||
mkdir -p \
|
||||
/usr/share/webapps/cops && \
|
||||
tar xf /tmp/cops.tar.gz -C \
|
||||
/usr/share/webapps/cops --strip-components=1 && \
|
||||
cd /usr/share/webapps/cops && \
|
||||
composer \
|
||||
install --no-dev --optimize-autoloader && \
|
||||
echo "**** cleanup ****" && \
|
||||
apk del --purge \
|
||||
build-dependencies && \
|
||||
rm -rf \
|
||||
/root/.composer \
|
||||
/tmp/*
|
||||
echo "**** install build packages ****" && \
|
||||
apk add --no-cache --upgrade --virtual=build-dependencies \
|
||||
curl \
|
||||
tar && \
|
||||
echo "**** install runtime packages ****" && \
|
||||
apk add --no-cache --upgrade \
|
||||
php8-ctype \
|
||||
php8-dom \
|
||||
php8-gd \
|
||||
php8-intl \
|
||||
php8-mbstring \
|
||||
php8-opcache \
|
||||
php8-openssl \
|
||||
php8-phar \
|
||||
php8-pdo_sqlite \
|
||||
php8-zip \
|
||||
php8-zlib && \
|
||||
echo "**** install cops ****" && \
|
||||
curl \
|
||||
-sS https://getcomposer.org/installer \
|
||||
| php -- --install-dir=/usr/bin --filename=composer --version=1.10.26 && \
|
||||
composer \
|
||||
global require "fxp/composer-asset-plugin:~1.1" && \
|
||||
if [ -z ${COPS_RELEASE+x} ]; then \
|
||||
COPS_RELEASE=$(curl -sX GET "https://api.github.com/repos/seblucas/cops/releases/latest" \
|
||||
| awk '/tag_name/{print $4;exit}' FS='[""]'); \
|
||||
fi && \
|
||||
curl -o \
|
||||
/tmp/cops.tar.gz -L \
|
||||
"https://github.com/seblucas/cops/archive/${COPS_RELEASE}.tar.gz" && \
|
||||
mkdir -p \
|
||||
/app/www/public && \
|
||||
tar xf /tmp/cops.tar.gz -C \
|
||||
/app/www/public --strip-components=1 && \
|
||||
cd /app/www/public && \
|
||||
composer \
|
||||
install --no-dev --optimize-autoloader && \
|
||||
sed -i 's|^[[:space:]]*return[[:space:]]@create_function[[:space:]]'\(''\''\$it'\'',[[:space:]]\$func'\)';| return function \(\$it\) use \(\$func\) \{\n return eval\(\$func\);\n \};|' vendor/seblucas/dot-php/doT.php && \
|
||||
echo "**** cleanup ****" && \
|
||||
apk del --purge \
|
||||
build-dependencies && \
|
||||
rm -rf \
|
||||
/root/.composer \
|
||||
/tmp/*
|
||||
|
||||
# add local files
|
||||
COPY root/ /
|
||||
|
||||
# ports and volumes
|
||||
EXPOSE 80
|
||||
VOLUME /config /books
|
||||
EXPOSE 80 443
|
||||
VOLUME /config
|
||||
|
||||
@ -257,6 +257,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)).
|
||||
* **22.11.20:** - Pin composer version to 1.10.17.
|
||||
* **01.06.20:** - Rebasing to alpine 3.12.
|
||||
* **19.12.19:** - Rebasing to alpine 3.11.
|
||||
|
||||
@ -84,6 +84,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: "22.11.20:", desc: "Pin composer version to 1.10.17." }
|
||||
- { date: "01.06.20:", desc: "Rebasing to alpine 3.12." }
|
||||
- { date: "19.12.19:", desc: "Rebasing to alpine 3.11." }
|
||||
|
||||
@ -1,40 +0,0 @@
|
||||
server {
|
||||
|
||||
listen 80 default_server;
|
||||
# listen 443 ssl;
|
||||
server_name _;
|
||||
# ssl_certificate /config/keys/cert.crt;
|
||||
# ssl_certificate_key /config/keys/cert.key;
|
||||
access_log /config/log/nginx/access.log;
|
||||
error_log /config/log/nginx/error.log;
|
||||
root /var/www/localhost/cops;
|
||||
index index.php;
|
||||
|
||||
#Useful only for Kobo reader
|
||||
location /cops/ {
|
||||
rewrite ^/download/(\d+)/(\d+)/.*\.(.*)$ /fetch.php?data=$1&db=$2&type=$3 last;
|
||||
rewrite ^/download/(\d+)/.*\.(.*)$ /fetch.php?data=$1&type=$2 last;
|
||||
break;
|
||||
}
|
||||
|
||||
#Can break loading the images - if you don't see anything, comment
|
||||
location ~ ^/images.*\.(gif|png|ico|jpg)$ {
|
||||
expires 31d;
|
||||
}
|
||||
#Can also break loading the images, comment if it happens
|
||||
location ~ .(js|css|eot|svg|woff|ttf)$ {
|
||||
expires 31d;
|
||||
}
|
||||
|
||||
#Not necessarily correct, it depends on distro.
|
||||
location ~ \.php$ {
|
||||
include /etc/nginx/fastcgi_params;
|
||||
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
||||
fastcgi_pass 127.0.0.1:9000;
|
||||
}
|
||||
|
||||
location /books {
|
||||
root /;
|
||||
internal;
|
||||
}
|
||||
}
|
||||
47
root/defaults/nginx/site-confs/default.conf.sample
Normal file
47
root/defaults/nginx/site-confs/default.conf.sample
Normal file
@ -0,0 +1,47 @@
|
||||
## Version 2022/08/20 - Changelog: https://github.com/linuxserver/docker-cops/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/www/public;
|
||||
index index.html index.htm index.php;
|
||||
|
||||
#Useful only for Kobo reader
|
||||
location /cops/ {
|
||||
rewrite ^/download/(\d+)/(\d+)/.*\.(.*)$ /fetch.php?data=$1&db=$2&type=$3 last;
|
||||
rewrite ^/download/(\d+)/.*\.(.*)$ /fetch.php?data=$1&type=$2 last;
|
||||
break;
|
||||
}
|
||||
|
||||
#Can break loading the images - if you don't see anything, comment
|
||||
location ~ ^/images.*\.(gif|png|ico|jpg)$ {
|
||||
expires 31d;
|
||||
}
|
||||
#Can also break loading the images, comment if it happens
|
||||
location ~ .(js|css|eot|svg|woff|ttf)$ {
|
||||
expires 31d;
|
||||
}
|
||||
|
||||
location /books {
|
||||
root /;
|
||||
internal;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
@ -2,30 +2,28 @@
|
||||
|
||||
# create folders
|
||||
mkdir -p \
|
||||
/config/cache
|
||||
|
||||
# make symlink
|
||||
[[ ! -e /var/www/localhost/cops ]] && \
|
||||
ln -s /usr/share/webapps/cops /var/www/localhost/cops
|
||||
/config/cache
|
||||
|
||||
# clear previous config
|
||||
for f in /var/www/localhost/cops/config_local.*.php
|
||||
for f in /app/www/public/config_local.*.php
|
||||
do
|
||||
[ -f "$f" ] && rm "$f"
|
||||
if [ -f "$f" ]; then
|
||||
rm "$f"
|
||||
fi
|
||||
done
|
||||
|
||||
# copy config
|
||||
[[ ! -e /config/config_local.php ]] && \
|
||||
cp /defaults/config_local.php /config/config_local.php
|
||||
if [[ ! -e /config/config_local.php ]]; then
|
||||
cp /defaults/config_local.php /config/config_local.php
|
||||
fi
|
||||
|
||||
# copy extra user-profiles
|
||||
for f in /config/config_local*.php
|
||||
do
|
||||
cp "$f" /var/www/localhost/cops/
|
||||
cp "$f" /app/www/public/
|
||||
done
|
||||
|
||||
# permissions
|
||||
chown -R abc:abc \
|
||||
/config \
|
||||
/usr/share/webapps/cops \
|
||||
var/www/localhost/cops
|
||||
/config \
|
||||
/app/www/public
|
||||
|
||||
10
root/migrations/02-default-location
Normal file
10
root/migrations/02-default-location
Normal file
@ -0,0 +1,10 @@
|
||||
#!/usr/bin/with-contenv bash
|
||||
|
||||
DEFAULT_CONF="/config/nginx/site-confs/default.conf"
|
||||
OLD_ROOT="root\s*/var/www/localhost/cops;"
|
||||
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
|
||||
40
root/var/www/localhost/cops/index.html
Normal file
40
root/var/www/localhost/cops/index.html
Normal 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>
|
||||
Loading…
x
Reference in New Issue
Block a user