From 9fdb1bfc256f9c146df3638d16cf7670f797c80b Mon Sep 17 00:00:00 2001 From: Arjan Widlak Date: Tue, 30 Jun 2026 20:00:40 +0000 Subject: [PATCH] distribution -> deploy (git mv, history kept) > distributino/docker-compose.yml -> compose.yml in the root, paths in file updated > Dockerfile -> deploy/webgui/Containerfile > deploy/webgui/Containerfile now with FROM localhost/webgui-deps > New: deploy/webgui-deps/Containerfile with all cpan modules (and apt block that was above it) all modules their own RUN cpanm --notest line ENV PERL_CPANM_OPT to use cpan-mirror README.md, CONTEXT.md and .dockerignore updated --no-cache --force -> --notest (so i can test) --- .dockerignore | 2 +- CONTEXT.md | 7 +- Dockerfile | 183 ------------------ README.md | 28 +-- .../docker-compose.yml => compose.yml | 16 +- {distribution => deploy}/nginx/nginx.conf | 0 {distribution => deploy}/share/create.sql | 0 deploy/webgui-deps/Containerfile | 177 +++++++++++++++++ deploy/webgui/Containerfile | 32 +++ {distribution => deploy}/webgui/entrypoint | 0 {distribution => deploy}/webgui/modperl.pl | 0 {distribution => deploy}/webgui/webgui.conf | 0 .../webgui/www.example.com.conf | 0 13 files changed, 236 insertions(+), 209 deletions(-) delete mode 100644 Dockerfile rename distribution/docker-compose.yml => compose.yml (75%) rename {distribution => deploy}/nginx/nginx.conf (100%) rename {distribution => deploy}/share/create.sql (100%) create mode 100644 deploy/webgui-deps/Containerfile create mode 100644 deploy/webgui/Containerfile rename {distribution => deploy}/webgui/entrypoint (100%) rename {distribution => deploy}/webgui/modperl.pl (100%) rename {distribution => deploy}/webgui/webgui.conf (100%) rename {distribution => deploy}/webgui/www.example.com.conf (100%) diff --git a/.dockerignore b/.dockerignore index e09cf7093..6be2e513f 100644 --- a/.dockerignore +++ b/.dockerignore @@ -11,5 +11,5 @@ cpan-cache/ # Ignore Docker-related files -Dockerfile* +Containerfile* .dockerignore diff --git a/CONTEXT.md b/CONTEXT.md index 3ce0b3616..9361a7290 100644 --- a/CONTEXT.md +++ b/CONTEXT.md @@ -7,10 +7,11 @@ ## Directory Structure & Key Files - `CONTEXT.md`, this file - `README.md` of the WebGUI project -- `distribution/docker-compose.yml` Current orchestration -- `Dockerfile` - the Dockerfile of the WebGUI container +- `compose.yml` Current orchestration - the custom folder contains all files related to custom modules add to WebGUI -- the distribution folder contains +- the deploy folder contains +- - `webgui-deps/Containerfile` - system packages and Perl modules (cpanm), built first as `localhost/webgui-deps` +- - `webgui/Containerfile` - the WebGUI app image, built `FROM localhost/webgui-deps` - - `nginx/nginx.conf` - configuration file for nginx in seperate pod - - `share/create.sql` - the create database file so mariadb can function as a database service for WebGUI - - `webgui/entrypoint` - the script that runs when the WebGUI service starts diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index 33d07a262..000000000 --- a/Dockerfile +++ /dev/null @@ -1,183 +0,0 @@ -# Podman Containerfile -# build via compose.yml or: -# podman image build -q -t debian:podman-trixie -f Containerfile . -FROM debian:trixie - -ENV DEBIAN_FRONTEND="noninteractive" - -RUN apt update && apt -y install perl cpanminus libaspell-dev make libdbd-mysql-perl libdigest-perl-md5-perl libxml-simple-perl \ - libmodule-install-perl gcc libperl-dev default-libmysqlclient-dev libpng-dev build-essential libgd-dev mariadb-client imagemagick \ - libpng-dev libjpeg-dev libtiff-dev libapache2-mod-perl2 libapache2-mod-perl2-dev libapache2-request-perl libimage-magick-perl vim \ - apache2 apache2-utils mailutils \ -# could be removed for production: - curl procps - - -RUN cpanm --notest --no-cache --force \ - Algorithm::Permute \ - App::Cmd \ - Archive::Any \ - Archive::Tar \ - Archive::Zip \ - Business::OnlinePayment \ - Business::OnlinePayment::AuthorizeNet \ - Business::PayPal::API \ - Business::Tax::VAT::Validation \ - CHI \ - CSS::Minifier::XS \ - CSS::Packer \ - Cache::FastMmap \ - Capture::Tiny \ - Class::C3 \ - Class::InsideOut \ - Clone \ - Color::Calc \ - Compress::Zlib \ - Config::JSON \ - DBI \ - Data::ICal \ - DateTime \ - DateTime::Event::ICal \ - DateTime::Format::HTTP \ - DateTime::Format::Mail \ - DateTime::Format::Strptime \ - DBD::mysql@4.051 \ - Devel::StackTrace \ - Devel::StackTrace::WithLexicals \ - Digest::MD5 \ - Digest::SHA \ - Email::Valid \ - Exception::Class \ - Facebook::Graph \ - File::Path \ - Finance::Quote \ - GD \ - GD::Graph \ - Geo::Coder::Googlev3 \ - HTML::Form \ - HTML::Highlight \ - HTML::Packer \ - HTML::Parser \ - HTML::TagCloud \ - HTML::TagFilter \ - HTML::Template \ - HTML::Template::Expr \ - HTTP::BrowserDetect \ - HTTP::Exception \ - HTTP::Headers \ - HTTP::Request \ - IO::File::WithPath \ - IO::Interactive::Tiny \ - IO::Socket::SSL \ - IO::Zlib \ - Image::ExifTool \ - Imager \ - Imager::File::PNG \ - JSON \ - JSON::Any \ - JSON::PP \ - JavaScript::Minifier::XS \ - JavaScript::Packer \ - Kwargs \ - LWP \ - LWP::Protocol::https \ - List::MoreUtils \ - Locales \ - Log::Log4perl \ - Mail::DeliveryStatus::BounceParser \ - MIME::Tools \ - Module::Find \ - Monkey::Patch \ - Moose \ - MooseX::NonMoose \ - MooseX::Storage \ - MooseX::Storage::Format::JSON \ - Net::CIDR::Lite \ - Net::DNS \ - Net::LDAP \ - Net::POP3 \ - Net::SMTP \ - Net::Twitter \ - Number::Format \ - POE \ - POE::Component::Client::HTTP \ - POE::Component::IKC::Server \ - POE::Component::IKC \ - Package::Stash \ - Params::Validate \ - Path::Class \ - PerlIO::eol \ - Plack \ - Plack::Middleware::Debug \ - Plack::Middleware::Status \ - Plack::Request \ - Plack::Response \ - Pod::Coverage \ - Readonly \ - Scope::Guard \ - Search::QueryParser \ - Storable \ - Template \ - Test::Class \ - Test::Deep \ - Test::Differences \ - Test::Exception \ - Test::Harness \ - Test::Log::Dispatch \ - Test::LongString \ - Test::MockObject \ - Test::MockTime \ - Test::More \ - Test::Tester \ - Test::WWW::Mechanize::PSGI \ - Text::Aspell \ - Text::Balanced \ - Text::CSV_XS \ - Tie::CPHash \ - Tie::IxHash \ - Time::HiRes \ - Try::Tiny \ - URI::Escape \ - UUID::Tiny \ - Weather::Com::Finder \ - XML::FeedPP \ - XML::FeedPP::MediaRSS \ - XML::Simple \ - common::sense \ - namespace::autoclean - -RUN apt -y remove libjson-xs-perl -RUN apt-get clean -RUN rm -rf /var/lib/apt/lists/* - -#RUN cpanm --notest --force \ -# DBD::mysql@4.051 - - -ADD lib /data/WebGUI/lib -ADD sbin /data/WebGUI/sbin -ADD share /data/WebGUI/share -ADD www/extras /data/WebGUI/www/extras -ADD www/maintenance.html /data/WebGUI/www/maintenance.html -ADD www/uploads /data/WebGUI/uploads -ADD etc /data/WebGUI/etc - -ADD distribution/webgui/entrypoint /entrypoint - -ADD distribution/webgui/www.example.com.conf /etc/apache2/sites-available/000-default.conf -ADD distribution/webgui/webgui.conf /etc/apache2/mods-enabled/webgui.conf -ADD distribution/webgui/modperl.pl /etc/apache2/modperl.pl -RUN useradd --home=/data/WebGUI webgui; chown -R webgui: /data/WebGUI; chmod 755 /entrypoint; \ - # apt remove -y cpanminus make gcc libperl-dev ; rm -rf /root/.cpanm; \ - echo "ServerName localhost" >> /etc/apache2/apache2.conf; - -#USER webgui - -# zorgt voor een andere shell prompt in de container gestart in de development container -# ook wanneer die in dezelfde UTC namespace zit - always /after/ USER command -ENV CONTAINER_CONTEXT=inner -RUN printf '%s\n' 'export PS1="\u@${CONTAINER_CONTEXT}:\w\\$ "' >> ~/.bashrc - -WORKDIR /data/WebGUI - -CMD [ "/entrypoint" ] diff --git a/README.md b/README.md index ca6449eaf..944f4480e 100644 --- a/README.md +++ b/README.md @@ -35,7 +35,7 @@ WebGUI is a powerful, open-source content management system and web framework bu ### Recommended Modules -A comprehensive list of Perl dependencies is installed via `cpanm` (see Dockerfile for details). +A comprehensive list of Perl dependencies is installed via `cpanm` (see `deploy/webgui-deps/Containerfile` for details). ## Quick Start Installation @@ -110,27 +110,27 @@ mysql.server start apachectl start ``` -## Docker Deployment +## Podman Deployment -WebGUI includes Docker support for easy containerized deployment: +WebGUI includes Podman support for easy containerized deployment: -# Build Docker image +# Build the deps and app images ```bash -docker build -t webgui:latest . +podman build -t webgui-deps -f deploy/webgui-deps/Containerfile . +podman build -t webgui:latest -f deploy/webgui/Containerfile . ``` -# Run with docker-compose (see distribution/docker-compose.yml) +# Run with podman-compose (see compose.yml) ```bash -cd distribution -docker-compose up -d +podman-compose up -d ``` -The Docker setup includes: +The Podman setup includes: - Debian-based container with all dependencies - Apache 2 with mod_perl - MariaDB client - ImageMagick for image processing -- Nginx reverse proxy configuration (distribution/nginx/) +- Nginx reverse proxy configuration (deploy/nginx/) ## Project Structure @@ -144,7 +144,7 @@ The Docker setup includes: ├── t/ # Test suite ├── etc/ # Configuration files ├── docs/ # Documentation -├── distribution/ # Docker and deployment configs +├── deploy/ # Podman and deployment configs ├── www/ # Web content (uploads, extras) └── share/ # Shared resources (nginx config, SQL) ``` @@ -197,7 +197,7 @@ perl t/MyTest.t ### Virtual Host Configuration - `etc/www.example.com.conf` - Example virtual host config -- `distribution/webgui/www.example.com.conf` - Docker example +- `deploy/webgui/www.example.com.conf` - Podman example ## Database Schema @@ -275,7 +275,7 @@ Contributions are welcome! Please ensure: - Ensure WebguiRoot path is correct ### Missing Dependencies -- Use the Dockerfile as a reference for all dependencies +- Use `deploy/webgui-deps/Containerfile` as a reference for all dependencies - Install via cpanm: `cpanm Module::Name` - Run: `perl sbin/testEnvironment.pl` @@ -284,4 +284,4 @@ Contributions are welcome! Please ensure: - Plain Black home: http://www.plainblack.com - WebGUI Wiki: http://wiki.webgui.org - Test suite: `t/` directory with comprehensive test coverage -- Configuration examples: `etc/` and `distribution/` directories +- Configuration examples: `etc/` and `deploy/` directories diff --git a/distribution/docker-compose.yml b/compose.yml similarity index 75% rename from distribution/docker-compose.yml rename to compose.yml index 2d64ab285..05e815025 100644 --- a/distribution/docker-compose.yml +++ b/compose.yml @@ -1,4 +1,4 @@ -# This file is ideal for development and testing. +# This file is ideal for development and testing. # --- DO NOT USE FOR PRODUCTION --- # however, you can use it as a guide to create a proper production environment. services: @@ -11,20 +11,20 @@ services: - MYSQL_PASSWORD=123qwe - MYSQL_DATABASE=www_example_com volumes: - - ./share/create.sql:/docker-entrypoint-initdb.d/1.sql + - ./deploy/share/create.sql:/docker-entrypoint-initdb.d/1.sql ports: - 3306:3306 - + webgui: image: webgui:latest build: - context: .. - dockerfile: Dockerfile + context: . + dockerfile: deploy/webgui/Containerfile container_name: webgui depends_on: - db volumes: - - ../.:/data/WebGUI + - ./:/data/WebGUI expose: - "80" @@ -34,11 +34,11 @@ services: depends_on: - webgui volumes: - - ./nginx/nginx.conf:/etc/nginx/nginx.conf:ro + - ./deploy/nginx/nginx.conf:/etc/nginx/nginx.conf:ro ports: - "80:80" #TODO: add ssl later #- "443:443" # TODO: serve staatic files directly from nginx #- ./www:/var/www/html:ro - + diff --git a/distribution/nginx/nginx.conf b/deploy/nginx/nginx.conf similarity index 100% rename from distribution/nginx/nginx.conf rename to deploy/nginx/nginx.conf diff --git a/distribution/share/create.sql b/deploy/share/create.sql similarity index 100% rename from distribution/share/create.sql rename to deploy/share/create.sql diff --git a/deploy/webgui-deps/Containerfile b/deploy/webgui-deps/Containerfile new file mode 100644 index 000000000..a2d9a5747 --- /dev/null +++ b/deploy/webgui-deps/Containerfile @@ -0,0 +1,177 @@ +# Podman Containerfile for webgui-deps +# System packages and Perl modules for WebGUI, added one at a time so each +# can be audited for compile/test failures with its own podman layer. +# build via: podman build -t webgui-deps -f deploy/webgui-deps/Containerfile . +FROM debian:trixie + +ENV DEBIAN_FRONTEND="noninteractive" + +RUN apt update && apt -y install \ + perl \ + cpanminus \ + libaspell-dev \ + make \ + libdbd-mysql-perl \ + libdigest-perl-md5-perl \ + libxml-simple-perl \ + libmodule-install-perl \ + gcc \ + libperl-dev \ + default-libmysqlclient-dev \ + libpng-dev \ + build-essential \ + libgd-dev \ + mariadb-client \ + imagemagick \ + libjpeg-dev \ + libtiff-dev \ + libapache2-mod-perl2 \ + libapache2-mod-perl2-dev \ + libapache2-request-perl \ + libimage-magick-perl \ + vim \ + apache2 \ + apache2-utils \ + mailutils \ +# could be removed for production: + curl \ + procps + +ENV PERL_CPANM_OPT="--mirror file:///cpan-mirror \ +--mirror https://www.cpan.org" + +RUN cpanm --notest Algorithm::Permute +RUN cpanm --notest App::Cmd +RUN cpanm --notest Archive::Any +RUN cpanm --notest Archive::Tar +RUN cpanm --notest Archive::Zip +RUN cpanm --notest Business::OnlinePayment +RUN cpanm --notest Business::OnlinePayment::AuthorizeNet +RUN cpanm --notest Business::PayPal::API +RUN cpanm --notest Business::Tax::VAT::Validation +RUN cpanm --notest CHI +RUN cpanm --notest CSS::Minifier::XS +RUN cpanm --notest CSS::Packer +RUN cpanm --notest Cache::FastMmap +RUN cpanm --notest Capture::Tiny +RUN cpanm --notest Class::C3 +RUN cpanm --notest Class::InsideOut +RUN cpanm --notest Clone +RUN cpanm --notest Color::Calc +RUN cpanm --notest Compress::Zlib +RUN cpanm --notest Config::JSON +RUN cpanm --notest DBI +RUN cpanm --notest Data::ICal +RUN cpanm --notest DateTime +RUN cpanm --notest DateTime::Event::ICal +RUN cpanm --notest DateTime::Format::HTTP +RUN cpanm --notest DateTime::Format::Mail +RUN cpanm --notest DateTime::Format::Strptime +RUN cpanm --notest DBD::mysql@4.051 +RUN cpanm --notest Devel::StackTrace +RUN cpanm --notest Devel::StackTrace::WithLexicals +RUN cpanm --notest Digest::MD5 +RUN cpanm --notest Digest::SHA +RUN cpanm --notest Email::Valid +RUN cpanm --notest Exception::Class +RUN cpanm --notest Facebook::Graph +RUN cpanm --notest File::Path +RUN cpanm --notest Finance::Quote +RUN cpanm --notest GD +RUN cpanm --notest GD::Graph +RUN cpanm --notest Geo::Coder::Googlev3 +RUN cpanm --notest HTML::Form +RUN cpanm --notest HTML::Highlight +RUN cpanm --notest HTML::Packer +RUN cpanm --notest HTML::Parser +RUN cpanm --notest HTML::TagCloud +RUN cpanm --notest HTML::TagFilter +RUN cpanm --notest HTML::Template +RUN cpanm --notest HTML::Template::Expr +RUN cpanm --notest HTTP::BrowserDetect +RUN cpanm --notest HTTP::Exception +RUN cpanm --notest HTTP::Headers +RUN cpanm --notest HTTP::Request +RUN cpanm --notest IO::File::WithPath +RUN cpanm --notest IO::Interactive::Tiny +RUN cpanm --notest IO::Socket::SSL +RUN cpanm --notest IO::Zlib +RUN cpanm --notest Image::ExifTool +RUN cpanm --notest Imager +RUN cpanm --notest Imager::File::PNG +RUN cpanm --notest JSON +RUN cpanm --notest JSON::Any +RUN cpanm --notest JSON::PP +RUN cpanm --notest JavaScript::Minifier::XS +RUN cpanm --notest JavaScript::Packer +RUN cpanm --notest Kwargs +RUN cpanm --notest LWP +RUN cpanm --notest LWP::Protocol::https +RUN cpanm --notest List::MoreUtils +RUN cpanm --notest Locales +RUN cpanm --notest Log::Log4perl +RUN cpanm --notest Mail::DeliveryStatus::BounceParser +RUN cpanm --notest MIME::Tools +RUN cpanm --notest Module::Find +RUN cpanm --notest Monkey::Patch +RUN cpanm --notest Moose +RUN cpanm --notest MooseX::NonMoose +RUN cpanm --notest MooseX::Storage +RUN cpanm --notest MooseX::Storage::Format::JSON +RUN cpanm --notest Net::CIDR::Lite +RUN cpanm --notest Net::DNS +RUN cpanm --notest Net::LDAP +RUN cpanm --notest Net::POP3 +RUN cpanm --notest Net::SMTP +RUN cpanm --notest Net::Twitter +RUN cpanm --notest Number::Format +RUN cpanm --notest POE +RUN cpanm --notest POE::Component::Client::HTTP +RUN cpanm --notest POE::Component::IKC::Server +RUN cpanm --notest POE::Component::IKC +RUN cpanm --notest Package::Stash +RUN cpanm --notest Params::Validate +RUN cpanm --notest Path::Class +RUN cpanm --notest PerlIO::eol +RUN cpanm --notest Plack +RUN cpanm --notest Plack::Middleware::Debug +RUN cpanm --notest Plack::Middleware::Status +RUN cpanm --notest Plack::Request +RUN cpanm --notest Plack::Response +RUN cpanm --notest Pod::Coverage +RUN cpanm --notest Readonly +RUN cpanm --notest Scope::Guard +RUN cpanm --notest Search::QueryParser +RUN cpanm --notest Storable +RUN cpanm --notest Template +RUN cpanm --notest Test::Class +RUN cpanm --notest Test::Deep +RUN cpanm --notest Test::Differences +RUN cpanm --notest Test::Exception +RUN cpanm --notest Test::Harness +RUN cpanm --notest Test::Log::Dispatch +RUN cpanm --notest Test::LongString +RUN cpanm --notest Test::MockObject +RUN cpanm --notest Test::MockTime +RUN cpanm --notest Test::More +RUN cpanm --notest Test::Tester +RUN cpanm --notest Test::WWW::Mechanize::PSGI +RUN cpanm --notest Text::Aspell +RUN cpanm --notest Text::Balanced +RUN cpanm --notest Text::CSV_XS +RUN cpanm --notest Tie::CPHash +RUN cpanm --notest Tie::IxHash +RUN cpanm --notest Time::HiRes +RUN cpanm --notest Try::Tiny +RUN cpanm --notest URI::Escape +RUN cpanm --notest UUID::Tiny +RUN cpanm --notest Weather::Com::Finder +RUN cpanm --notest XML::FeedPP +RUN cpanm --notest XML::FeedPP::MediaRSS +RUN cpanm --notest XML::Simple +RUN cpanm --notest common::sense +RUN cpanm --notest namespace::autoclean + +RUN apt -y remove libjson-xs-perl +RUN apt-get clean +RUN rm -rf /var/lib/apt/lists/* diff --git a/deploy/webgui/Containerfile b/deploy/webgui/Containerfile new file mode 100644 index 000000000..af3b24104 --- /dev/null +++ b/deploy/webgui/Containerfile @@ -0,0 +1,32 @@ +# Podman Containerfile +# build via compose.yml or: +# podman image build -q -t webgui -f deploy/webgui/Containerfile . +FROM localhost/webgui-deps + +ADD lib /data/WebGUI/lib +ADD sbin /data/WebGUI/sbin +ADD share /data/WebGUI/share +ADD www/extras /data/WebGUI/www/extras +ADD www/maintenance.html /data/WebGUI/www/maintenance.html +ADD www/uploads /data/WebGUI/uploads +ADD etc /data/WebGUI/etc + +ADD deploy/webgui/entrypoint /entrypoint + +ADD deploy/webgui/www.example.com.conf /etc/apache2/sites-available/000-default.conf +ADD deploy/webgui/webgui.conf /etc/apache2/mods-enabled/webgui.conf +ADD deploy/webgui/modperl.pl /etc/apache2/modperl.pl +RUN useradd --home=/data/WebGUI webgui; chown -R webgui: /data/WebGUI; chmod 755 /entrypoint; \ + # apt remove -y cpanminus make gcc libperl-dev ; rm -rf /root/.cpanm; \ + echo "ServerName localhost" >> /etc/apache2/apache2.conf; + +#USER webgui + +# zorgt voor een andere shell prompt in de container gestart in de development container +# ook wanneer die in dezelfde UTC namespace zit - always /after/ USER command +ENV CONTAINER_CONTEXT=inner +RUN printf '%s\n' 'export PS1="\u@${CONTAINER_CONTEXT}:\w\\$ "' >> ~/.bashrc + +WORKDIR /data/WebGUI + +CMD [ "/entrypoint" ] diff --git a/distribution/webgui/entrypoint b/deploy/webgui/entrypoint similarity index 100% rename from distribution/webgui/entrypoint rename to deploy/webgui/entrypoint diff --git a/distribution/webgui/modperl.pl b/deploy/webgui/modperl.pl similarity index 100% rename from distribution/webgui/modperl.pl rename to deploy/webgui/modperl.pl diff --git a/distribution/webgui/webgui.conf b/deploy/webgui/webgui.conf similarity index 100% rename from distribution/webgui/webgui.conf rename to deploy/webgui/webgui.conf diff --git a/distribution/webgui/www.example.com.conf b/deploy/webgui/www.example.com.conf similarity index 100% rename from distribution/webgui/www.example.com.conf rename to deploy/webgui/www.example.com.conf