diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..1233aae --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.secrets diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml deleted file mode 100644 index 6f4e2c5..0000000 --- a/.gitlab-ci.yml +++ /dev/null @@ -1,43 +0,0 @@ -stages: - - build - - sync - - package - -default: - before_script: - - echo login into the docker registry at $CI_REGISTRY with user $CI_REGISTRY_USER and $CI_DEPLOY_PASSWORD - - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY - # Default branch leaves tag empty (= latest tag) - # All other branches are tagged with the escaped branch name (commit ref slug) - - echo defining tag to reflect the branch - - | - date=$(date '+%Y-%m-%d') - packagename="gitlab-backup" - if [[ "$CI_COMMIT_BRANCH" == "$CI_DEFAULT_BRANCH" ]]; then - tag="" - version=${date} - echo "Running on default branch '$CI_DEFAULT_BRANCH': tag = 'latest'" - else - tag=":$CI_COMMIT_REF_SLUG" - version=${date}-${CI_COMMIT_REF_SLUG}-${CI_PIPELINE_ID} - echo "Running on branch '$CI_COMMIT_BRANCH': tag = $tag" - fi - - -build: - stage: build - image: docker:latest - services: - - docker:dind - script: - - docker build --pull -t "$CI_REGISTRY_IMAGE${tag}" --build-arg git_user=${GITLAB_USER} --build-arg git_pass=${GITLAB_PASSWORD} . - - docker push "$CI_REGISTRY_IMAGE${tag}" - # Run this job in a branch where a Dockerfile exists - rules: - - if: $CI_COMMIT_MESSAGE =~ /skip build/ - when: never - - if: $CI_COMMIT_MESSAGE =~ /skip all/ - when: never - - if: $CI_COMMIT_BRANCH - exists: - - Dockerfile \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 6b0fe4a..b2e2e3e 100755 --- a/Dockerfile +++ b/Dockerfile @@ -2,13 +2,12 @@ FROM alpine LABEL authors="toxic0berliner" # Set correct environment variables -ENV HOME /duc +ENV HOME="/duc" # Install Dependencies RUN apk add --no-cache --no-check-certificate\ wget \ git \ - rsync \ bash \ automake \ autoconf \ @@ -18,13 +17,17 @@ RUN apk add --no-cache --no-check-certificate\ ncurses-dev \ libncursesw \ zlib \ + zstd \ + zstd-libs \ + gcompat \ cairo-dev \ pango-dev \ build-base \ kyotocabinet-dev && \ cd /tmp && \ - git -c http.sslVerify=false clone https://github.com/estraier/tkrzw.git &&\ - cd /tmp/tkrzw && \ + wget https://dbmx.net/tkrzw/pkg/tkrzw-1.0.25.tar.gz &&\ + tar -xf tkrzw-1.0.25.tar.gz &&\ + cd /tmp/tkrzw-1.0.25 && \ ./configure && \ make && \ make install && \ @@ -32,37 +35,16 @@ RUN apk add --no-cache --no-check-certificate\ rm -rf tkrzw -# Install duc -# /duc/db is a directory to mount multiple DBs, for server. duc_startup.sh look into this directory and create CGIs +# Build duc RUN mkdir /duc && \ - mkdir /duc/db && \ cd /duc && \ git -c http.sslVerify=false clone https://github.com/zevv/duc.git &&\ cd /duc/duc && \ autoreconf -i && \ - ./configure && \ + autoupdate && \ + ./configure --disable-cairo --disable-ui --disable-x11 --with-db-backend=tkrzw && \ make && \ - make install && \ - cd .. && \ - rm -rf duc - -COPY assets/000-default.conf /etc/apache2/sites-available/ -COPY assets/ducrc /etc/ -COPY assets/duc_startup.sh /duc/ - -# create a starter database so that we can set permissions for cgi access -RUN mkdir /var/www/duc && \ - mkdir /host && \ - chmod 777 /duc/ - -# DEBUG BELOW IS COMMENTED TO ALLOW SUCESSFULL IMAGE BUILD TO DEBUG CURRENT ISSUES WITH DUC -# RUN duc index /host/ && \ -# chmod 777 /duc/.duc.db && \ -# a2enmod cgi && \ -# chmod +x /duc/duc_startup.sh - -ENV DUC_CGI_OPTIONS --list --tooltip --dpi=120 -EXPOSE 80 + make install +ENV DUC_CGI_OPTIONS="--list --tooltip --dpi=120" -WORKDIR /duc -CMD /duc/duc_startup.sh +WORKDIR /duc \ No newline at end of file diff --git a/README.md b/README.md index afed684..27197a8 100644 --- a/README.md +++ b/README.md @@ -6,33 +6,17 @@ This is a fork of [minostauros/duc-docker](https://github.com/minostauros/duc-do # duc-docker -![Docker Pulls](https://img.shields.io/docker/pulls/tigerdockermediocore/duc-docker) [![Automated build on Github Actions](https://github.com/minostauros/duc-docker/actions/workflows/docker-publish.yml/badge.svg)](https://github.com/minostauros/duc-docker/pkgs/container/duc-docker) +![Docker Pulls](https://img.shields.io/docker/pulls/toxic0berliner/duc-docker) [![Automated build on Github Actions](https://github.com/toxic0berliner/duc-docker/actions/workflows/docker-publish.yml/badge.svg)](https://github.com/toxic0berliner/duc-docker/pkgs/container/duc-docker) Dockerized version of [duc](https://duc.zevv.nl), a disk usage analyzer. -See [docker hub](https://hub.docker.com/r/tigerdockermediocore/duc-docker/) to pull the images. +See [docker hub](https://hub.docker.com/r/toxic0berliner/duc-docker/) to pull the images. -This image has some tweaks to achieve my personal need, but everything is straightforward (see its [github repo](https://github.com/minostauros/duc-docker/)). +This image has some tweaks to achieve my personal need, but everything is straightforward (see its [github repo](https://github.com/toxic0berliner/duc-docker/)). +# Building +Run `docker build -t duc-docker .` then `docker run --rm -it --hostname duc-docker duc-docker bash` to get a shell in the container. -## Usage -### Apache CGI Server -By default, this image will just start up as an apache server for duc databases. Say you have two db files named `one.db`, and `two.db` in your host directoy `/mydbs/` and a database file `/home/myduc.db` . Then running the following command -```sh -docker run -d -p 80:80 -v /mydbs/:/duc/db/:ro -v /home/myduc.db:/duc/.duc.db:ro tigerdockermediocore/duc-docker:latest -``` -will provide following web pages - - http://localhost:80/one.cgi <- based on /mydbs/one.db mounted as /duc/db/one.db - - http://localhost:80/two.cgi <- based on /mydbs/two.db mounted as /duc/db/two.db - - http://localhost:80/index.cgi <- based on /home/myduc.db mounted as /duc/.duc.db - - -### duc Indexing -Mount directories you want to index into `/host` with readonly property. For example, -```sh -docker run -d -v /home:/host/home:ro -v /media:/host/media:ro tigerdockermediocore/duc-docker:latest duc index /host -``` -will index `/home` and `/media`, creating `/duc/.duc.db` inside the container. So don't forget to pull out the db file afterward! ## References - Original duc: https://duc.zevv.nl - - Reference duc-docker: https://hub.docker.com/r/digitalman2112/duc/ + - Reference duc-docker: https://github.com/minostauros/duc-docker/ diff --git a/assets/000-default.conf b/assets/000-default.conf deleted file mode 100755 index 6363b57..0000000 --- a/assets/000-default.conf +++ /dev/null @@ -1,22 +0,0 @@ - - ServerAdmin webmaster@localhost - DocumentRoot /var/www/duc/ - - ScriptAlias /cgi-bin/ /var/www/duc/ - - - AllowOverride None - PassEnv DUC_CGI_OPTIONS - AddType application/json .json - AddHandler cgi-script .cgi .pl - Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch - - Require all granted - - - - ErrorLog ${APACHE_LOG_DIR}/error.log - CustomLog ${APACHE_LOG_DIR}/access.log combined - - -# vim: syntax=apache ts=4 sw=4 sts=4 sr noet diff --git a/assets/duc_startup.sh b/assets/duc_startup.sh deleted file mode 100644 index 0212fae..0000000 --- a/assets/duc_startup.sh +++ /dev/null @@ -1,72 +0,0 @@ -#!/bin/bash -# Make sure we're not confused by old, incompletely-shutdown httpd -# context after restarting the container. httpd won't start correctly -# if it thinks it is already running. -rm -rf /run/httpd/* - -# Set variable for index.cgi path -index_file="/var/www/duc/index.html" - -# Check for existing index.cgi and remove it -if [ -f "/var/www/duc/index.cgi" ]; then - rm -f "/var/www/duc/index.cgi" -fi - -# Check for existing index and empty it if it exists, ensure it is executable -if [ -f "$index_file" ]; then - > "$index_file" - chmod 644 "$index_file" -fi - -db_dir="/duc/db/" -# Start building the index.html content -# Start building the index.html content -cat << EOF >> "$index_file" - - - Available DUC databases - - - - - " >> "$index_file" -echo "" >> "$index_file" - -/usr/sbin/apache2ctl -D FOREGROUND diff --git a/assets/ducrc b/assets/ducrc deleted file mode 100644 index c3f2d19..0000000 --- a/assets/ducrc +++ /dev/null @@ -1,2 +0,0 @@ -[global] -database /duc/.duc.db diff --git a/assets/index.cgi b/assets/index.cgi deleted file mode 100755 index 6db6458..0000000 --- a/assets/index.cgi +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -/usr/local/bin/duc cgi $DUC_CGI_OPTIONS -d /duc/.duc.db -