Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 57 additions & 0 deletions .github/workflows/docker-gui.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Build GUI Docker image

on:
push:
branches: [master, develop]
pull_request:
branches: [master, develop]
workflow_dispatch:

jobs:
build-gui-image:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '22'
cache: 'npm'

- name: Install dependencies
run: npm ci

- name: Build release archive
run: npm run release

- name: Extract version from package.json
id: pkg
run: |
VERSION=$(node -p "require('./package.json').version")
echo "version=$VERSION" >> "$GITHUB_OUTPUT"

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Build GUI Docker image
uses: docker/build-push-action@v5
with:
context: .
file: docker/Dockerfile-gui
build-args: |
version=${{ steps.pkg.outputs.version }}
tags: gui:${{ steps.pkg.outputs.version }}
push: false
load: true

- name: Verify image exists
run: docker images gui:${{ steps.pkg.outputs.version }}

- name: Test Apache configuration inside image
run: |
docker run --rm \
-e ZONEMASTER_BACKEND_HOST=zmhost \
-e ZONEMASTER_BACKEND_PORT=5000 \
gui:${{ steps.pkg.outputs.version }} httpd -t
23 changes: 20 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,11 +1,28 @@
VERSION = $(shell jq -r '.version' package.json)

docker-build:
docker-build: docker-build-all-in-one docker-build-stand-alone

docker-build-all-in-one:
docker build --tag zonemaster/all-in-one:local --build-arg version=$(VERSION) -f docker/Dockerfile .

docker-tag-version:
docker-build-stand-alone:
docker build --tag zonemaster/gui:local --build-arg version=$(VERSION) -f docker/Dockerfile-gui .


docker-tag-version: docker-tag-version-all-in-one docker-tag-version-stand-alone

docker-tag-version-all-in-one:
docker tag zonemaster/all-in-one:local zonemaster/all-in-one:$(VERSION)

docker-tag-latest:
docker-tag-version-stand-alone:
docker tag zonemaster/gui:local zonemaster/gui:$(VERSION)


docker-tag-latest: docker-tag-latest-all-in-one docker-tag-latest-stand-alone

docker-tag-latest-all-in-one:
docker tag zonemaster/all-in-one:local zonemaster/all-in-one:latest

docker-tag-latest-stand-alone:
docker tag zonemaster/gui:local zonemaster/gui:latest

21 changes: 21 additions & 0 deletions docker/Dockerfile-gui
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
FROM httpd:2.4 AS build

ARG version

RUN apt update
RUN apt install -y unzip

COPY docker/httpd.conf /usr/local/apache2/conf/httpd.conf

USER root
COPY ./zonemaster_web_gui_${version}.zip /tmp

WORKDIR /tmp
RUN unzip zonemaster_web_gui_${version}.zip
RUN mv dist/* /usr/local/apache2/htdocs/

FROM httpd:2.4

EXPOSE 80

COPY --from=build /usr/local/apache2/ /usr/local/apache2
82 changes: 82 additions & 0 deletions docker/httpd.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
# Apache configuration file for Zonemaster GUI
# Based on the httpd:2.4 image

ServerRoot "/usr/local/apache2"

Listen 80

LoadModule mpm_event_module modules/mod_mpm_event.so
LoadModule authn_core_module modules/mod_authn_core.so
LoadModule authz_core_module modules/mod_authz_core.so
LoadModule mime_module modules/mod_mime.so
LoadModule log_config_module modules/mod_log_config.so
LoadModule headers_module modules/mod_headers.so
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_http_module modules/mod_proxy_http.so
LoadModule unixd_module modules/mod_unixd.so
LoadModule dir_module modules/mod_dir.so
LoadModule rewrite_module modules/mod_rewrite.so
LoadModule env_module modules/mod_env.so

<IfModule unixd_module>
User www-data
Group www-data
</IfModule>

<Directory />
AllowOverride none
Require all denied
</Directory>

DocumentRoot "/usr/local/apache2/htdocs"

<Directory "/usr/local/apache2/htdocs">
Options FollowSymLinks
AllowOverride None
Require all granted

Define DEFAULT_LANGUAGE "en"

RewriteEngine On
RewriteRule ^$ /${DEFAULT_LANGUAGE} [R]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^result/[^/]+/?$ ${DEFAULT_LANGUAGE}/result/id/index.html [L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]+)/result/[^/]+/?$ $1/result/id/index.html [L]
</Directory>

<Location "/api">
ProxyPass http://${ZONEMASTER_BACKEND_HOST}:${ZONEMASTER_BACKEND_PORT}/
ProxyPassReverse http://${ZONEMASTER_BACKEND_HOST}:${ZONEMASTER_BACKEND_PORT}/
ProxyPreserveHost On
</Location>

<IfModule dir_module>
DirectoryIndex index.html
</IfModule>

<Files ".ht*">
Require all denied
</Files>

ErrorLog /proc/self/fd/2
LogLevel warn

<IfModule log_config_module>
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %b" common

CustomLog /proc/self/fd/1 common
</IfModule>

<IfModule headers_module>
RequestHeader unset Proxy early
</IfModule>

<IfModule mime_module>
TypesConfig conf/mime.types
</IfModule>
Loading