Initial commit
This commit is contained in:
commit
bc8b826e7c
9
.editorconfig
Normal file
9
.editorconfig
Normal file
@ -0,0 +1,9 @@
|
||||
root = true
|
||||
|
||||
[*]
|
||||
end_of_line = lf
|
||||
charset = utf-8
|
||||
trim_trailing_whitespace = true
|
||||
insert_final_newline = true
|
||||
indent_style = space
|
||||
indent_size = 4
|
2
.gitignore
vendored
Executable file
2
.gitignore
vendored
Executable file
@ -0,0 +1,2 @@
|
||||
*~
|
||||
.DS_Store
|
10
.gitlab-ci.yml
Normal file
10
.gitlab-ci.yml
Normal file
@ -0,0 +1,10 @@
|
||||
build:
|
||||
image: docker:latest
|
||||
services:
|
||||
- docker:dind
|
||||
stage: build
|
||||
script:
|
||||
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
|
||||
- docker build --pull --tag $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME --tag $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA .
|
||||
- docker push $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME
|
||||
- docker push $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA
|
45
Dockerfile
Normal file
45
Dockerfile
Normal file
@ -0,0 +1,45 @@
|
||||
FROM registry.gitlab.com/thallian/docker-php7-fpm:master
|
||||
|
||||
ENV FPMUSER nginx
|
||||
ENV FPMGROUP nginx
|
||||
|
||||
ENV VERSION master
|
||||
|
||||
RUN apk add --no-cache \
|
||||
libressl \
|
||||
git \
|
||||
nginx \
|
||||
wget \
|
||||
php7 \
|
||||
php7-opcache \
|
||||
php7-pcntl \
|
||||
php7-gd \
|
||||
php7-sqlite3 \
|
||||
php7-json \
|
||||
php7-intl \
|
||||
php7-xml \
|
||||
php7-mbstring \
|
||||
php7-zip \
|
||||
php7-openssl \
|
||||
php7-phar \
|
||||
php7-pdo_sqlite \
|
||||
php7-ctype \
|
||||
php7-xmlwriter \
|
||||
php7-dom
|
||||
|
||||
RUN mkdir -p /usr/share/webapps/cops
|
||||
RUN wget -qO- https://github.com/seblucas/cops/archive/$VERSION.tar.gz | tar xz -C /usr/share/webapps/cops --strip 1
|
||||
|
||||
WORKDIR /usr/share/webapps/cops
|
||||
RUN wget https://getcomposer.org/composer.phar
|
||||
RUN php composer.phar global require "fxp/composer-asset-plugin:~1.1"
|
||||
RUN php composer.phar install --no-dev --optimize-autoloader
|
||||
|
||||
RUN chown -R nginx:nginx /usr/share/webapps/cops
|
||||
|
||||
RUN mkdir /run/nginx
|
||||
RUN rm /etc/nginx/conf.d/default.conf
|
||||
|
||||
ADD /rootfs /
|
||||
|
||||
VOLUME /var/lib/cops/calibre
|
16
README.md
Normal file
16
README.md
Normal file
@ -0,0 +1,16 @@
|
||||
[COPS](https://github.com/seblucas/cops), a web-based light alternative to Calibre content server.
|
||||
|
||||
# Volumes
|
||||
- `/var/lib/cops/calibre`
|
||||
|
||||
# Environment Variables
|
||||
## DOMAIN
|
||||
Domain where the cops instance is reachable.
|
||||
|
||||
## TITLE
|
||||
- default: COPS
|
||||
|
||||
Website title.
|
||||
|
||||
# Ports
|
||||
- 80
|
3
rootfs/etc/confd/conf.d/config.local.php.toml
Normal file
3
rootfs/etc/confd/conf.d/config.local.php.toml
Normal file
@ -0,0 +1,3 @@
|
||||
[template]
|
||||
src = "config_local.php.tmpl"
|
||||
dest = "/usr/share/webapps/cops/config_local.php"
|
3
rootfs/etc/confd/conf.d/cops.conf.toml
Normal file
3
rootfs/etc/confd/conf.d/cops.conf.toml
Normal file
@ -0,0 +1,3 @@
|
||||
[template]
|
||||
src = "cops.conf.tmpl"
|
||||
dest = "/etc/nginx/conf.d/cops.conf"
|
13
rootfs/etc/confd/templates/config_local.php.tmpl
Normal file
13
rootfs/etc/confd/templates/config_local.php.tmpl
Normal file
@ -0,0 +1,13 @@
|
||||
<?php
|
||||
if (!isset($config))
|
||||
$config = array();
|
||||
|
||||
$config['calibre_directory'] = '/var/lib/cops/calibre/';
|
||||
$config['calibre_internal_directory'] = '/calibre/';
|
||||
$config['cops_full_url'] = '{{ getenv "DOMAIN" }}';
|
||||
|
||||
$config['cops_x_accel_redirect'] = "X-Accel-Redirect";
|
||||
|
||||
$config['cops_title_default'] = "{{ getenv "TITLE" "COPS" }}";
|
||||
|
||||
$config['cops_use_url_rewriting'] = "1";
|
50
rootfs/etc/confd/templates/cops.conf.tmpl
Normal file
50
rootfs/etc/confd/templates/cops.conf.tmpl
Normal file
@ -0,0 +1,50 @@
|
||||
error_log /dev/stdout info;
|
||||
access_log /dev/stdout;
|
||||
|
||||
upstream php {
|
||||
server 127.0.0.1:9000;
|
||||
}
|
||||
|
||||
server {
|
||||
listen 80;
|
||||
|
||||
server_name {{getenv "DOMAIN"}};
|
||||
|
||||
add_header X-Content-Type-Options nosniff;
|
||||
add_header X-XSS-Protection "1; mode=block";
|
||||
add_header X-Robots-Tag none;
|
||||
add_header X-Download-Options noopen;
|
||||
add_header X-Permitted-Cross-Domain-Policies none;
|
||||
|
||||
index index.php;
|
||||
|
||||
root /usr/share/webapps/cops/;
|
||||
|
||||
gzip on;
|
||||
gzip_vary on;
|
||||
gzip_comp_level 4;
|
||||
gzip_min_length 256;
|
||||
|
||||
location /download/ {
|
||||
rewrite ^/download/(\d+)/(\d+)/.*\.(.*)$ /fetch.php?data=$1&db=$2&type=$3 last;
|
||||
rewrite ^/download/(\d+)/.*\.(.*)$ /fetch.php?data=$1&type=$2 last;
|
||||
break;
|
||||
}
|
||||
|
||||
location ~ \.php$ {
|
||||
include fastcgi_params;
|
||||
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
||||
fastcgi_param PATH_INFO $fastcgi_path_info;
|
||||
fastcgi_param HTTPS on;
|
||||
|
||||
fastcgi_param modHeadersAvailable true;
|
||||
fastcgi_param front_controller_active true;
|
||||
fastcgi_pass php;
|
||||
fastcgi_intercept_errors on;
|
||||
}
|
||||
|
||||
location /calibre {
|
||||
root /var/lib/cops;
|
||||
internal;
|
||||
}
|
||||
}
|
3
rootfs/etc/services.d/nginx/run
Normal file
3
rootfs/etc/services.d/nginx/run
Normal file
@ -0,0 +1,3 @@
|
||||
#!/usr/bin/with-contenv sh
|
||||
|
||||
exec nginx -g "daemon off;"
|
Loading…
Reference in New Issue
Block a user