diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..d741e40 --- /dev/null +++ b/.editorconfig @@ -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 diff --git a/.gitea/workflows/container.yaml b/.gitea/workflows/container.yaml deleted file mode 100644 index e48b3fd..0000000 --- a/.gitea/workflows/container.yaml +++ /dev/null @@ -1,12 +0,0 @@ -name: Build Multiarch Container Image -on: [push] -jobs: - call-reusable-workflow: - uses: container/multiarch-build-workflow/.gitea/workflows/build.yaml@main - with: - repository: ${{ gitea.repository }} - ref_name: ${{ gitea.ref_name }} - sha: ${{ gitea.sha }} - registry_url: ${{ secrets.REGISTRY_URL }} - registry_user: ${{ secrets.REGISTRY_USER }} - registry_pw: ${{ secrets.REGISTRY_PW }} diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..e9fee4c --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,13 @@ +variables: + IMAGE_NAME: thallian/cops + +build: + stage: build + script: + - docker login -u $DOCKER_USER -p $DOCKER_PASSWORD $DOCKER_REGISTRY + - docker build -t $IMAGE_NAME:$CI_COMMIT_SHA . + - docker build -t $IMAGE_NAME:$CI_COMMIT_REF_NAME . + - docker build -t $IMAGE_NAME:latest . + - docker push $IMAGE_NAME:$CI_COMMIT_SHA + - docker push $IMAGE_NAME:$CI_COMMIT_REF_NAME + - docker push $IMAGE_NAME:latest diff --git a/Containerfile b/Containerfile deleted file mode 100644 index 80eefcf..0000000 --- a/Containerfile +++ /dev/null @@ -1,43 +0,0 @@ -FROM docker.io/thallian/php8-fpm:3.19-8.3 - -ENV FPMUSER nginx -ENV FPMGROUP nginx - -ENV VERSION 2.5.0 - -RUN apk add --no-cache \ - openssl \ - git \ - nginx \ - wget \ - php83 \ - php83-opcache \ - php83-pcntl \ - php83-gd \ - php83-sqlite3 \ - php83-json \ - php83-intl \ - php83-xml \ - php83-mbstring \ - php83-zip \ - php83-openssl \ - php83-phar \ - php83-pdo_sqlite \ - php83-ctype \ - php83-xmlwriter \ - php83-dom - -RUN mkdir -p /usr/share/webapps/cops -RUN wget -qO- https://github.com/mikespub-org/seblucas-cops/archive/$VERSION.tar.gz | tar xz -C /usr/share/webapps/cops --strip 1 - -WORKDIR /usr/share/webapps/cops -ENV COMPOSER_HASH=72600201c73c7c4b218f1c0511b36d8537963e36aafa244757f52309f885b314 -RUN wget https://getcomposer.org/download/2.6.6/composer.phar -RUN echo "$COMPOSER_HASH composer.phar" | sha256sum -c - || exit 1 -RUN php83 composer.phar install --no-dev --optimize-autoloader - -RUN chown -R nginx:nginx /usr/share/webapps/cops - -ADD /rootfs / - -VOLUME /var/lib/cops/calibre diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..8852e35 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,45 @@ +FROM thallian/php7-fpm:latest + +ENV FPMUSER nginx +ENV FPMGROUP nginx + +ENV VERSION f65537cdc6f11e135fdc0fbfcaf05524f63ec667 + +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/download/1.9.0/composer.phar +RUN php composer.phar --no-plugins 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 diff --git a/README.md b/README.md index 97ab901..c6ea0ee 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[COPS](https://github.com/mikespub-org/seblucas-cops), a web-based light alternative to Calibre content server. +[COPS](https://github.com/seblucas/cops), a web-based light alternative to Calibre content server. # Volumes - `/var/lib/cops/calibre` @@ -13,4 +13,4 @@ Domain where the cops instance is reachable. Website title. # Ports -- 8080 +- 80 diff --git a/rootfs/etc/confd/conf.d/cops.conf.toml b/rootfs/etc/confd/conf.d/cops.conf.toml index c337d7d..46dafa7 100644 --- a/rootfs/etc/confd/conf.d/cops.conf.toml +++ b/rootfs/etc/confd/conf.d/cops.conf.toml @@ -1,3 +1,3 @@ [template] src = "cops.conf.tmpl" -dest = "/etc/nginx/http.d/cops.conf" +dest = "/etc/nginx/conf.d/cops.conf" diff --git a/rootfs/etc/confd/templates/config_local.php.tmpl b/rootfs/etc/confd/templates/config_local.php.tmpl index 3c5c6c4..cdfde7e 100644 --- a/rootfs/etc/confd/templates/config_local.php.tmpl +++ b/rootfs/etc/confd/templates/config_local.php.tmpl @@ -4,6 +4,7 @@ $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"; diff --git a/rootfs/etc/confd/templates/cops.conf.tmpl b/rootfs/etc/confd/templates/cops.conf.tmpl index e0997ef..3cc3cd2 100644 --- a/rootfs/etc/confd/templates/cops.conf.tmpl +++ b/rootfs/etc/confd/templates/cops.conf.tmpl @@ -6,8 +6,7 @@ upstream php { } server { - listen [::]:8080; - listen 8080; + listen 80; server_name {{getenv "DOMAIN"}}; diff --git a/rootfs/etc/s6-overlay/s6-rc.d/nginx/dependencies b/rootfs/etc/s6-overlay/s6-rc.d/nginx/dependencies deleted file mode 100644 index 7ba7514..0000000 --- a/rootfs/etc/s6-overlay/s6-rc.d/nginx/dependencies +++ /dev/null @@ -1 +0,0 @@ -confd diff --git a/rootfs/etc/s6-overlay/s6-rc.d/nginx/type b/rootfs/etc/s6-overlay/s6-rc.d/nginx/type deleted file mode 100644 index 5883cff..0000000 --- a/rootfs/etc/s6-overlay/s6-rc.d/nginx/type +++ /dev/null @@ -1 +0,0 @@ -longrun diff --git a/rootfs/etc/s6-overlay/s6-rc.d/user/contents.d/nginx b/rootfs/etc/s6-overlay/s6-rc.d/user/contents.d/nginx deleted file mode 100644 index e69de29..0000000 diff --git a/rootfs/etc/s6-overlay/s6-rc.d/nginx/run b/rootfs/etc/services.d/nginx/run similarity index 51% rename from rootfs/etc/s6-overlay/s6-rc.d/nginx/run rename to rootfs/etc/services.d/nginx/run index e33de41..807d20a 100644 --- a/rootfs/etc/s6-overlay/s6-rc.d/nginx/run +++ b/rootfs/etc/services.d/nginx/run @@ -1,3 +1,3 @@ -#!/bin/sh +#!/usr/bin/with-contenv sh exec nginx -g "daemon off;"