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
111 changes: 111 additions & 0 deletions .github/workflows/ci-webui-current.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
name: ci-webui-current

on:
push:
paths:
- 'webui/current-ubuntu/**'
- '.github/workflows/ci-webui-current.yml'
pull_request:
paths:
- 'webui/current-ubuntu/**'
- '.github/workflows/ci-webui-current.yml'
workflow_dispatch:
schedule:
- cron: '0 6 * * 0' # Weekly on Sunday 6:00 UTC

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository_owner }}/bareos-webui

jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up QEMU
uses: docker/setup-qemu-action@v3
with:
platforms: all

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

- name: Build image for testing
uses: docker/build-push-action@v6
with:
context: webui/current-ubuntu
load: true
tags: bareos-webui:test

test:
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

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

- name: Build image for testing
uses: docker/build-push-action@v6
with:
context: webui/current-ubuntu
load: true
tags: bareos-webui:test

- name: Test image
run: |
docker run --rm bareos-webui:test cat /etc/bareos-webui/directors.ini
echo "Image test passed"

push:
needs: test
if: |
(github.event_name == 'push' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch') &&
github.ref == 'refs/heads/master'
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up QEMU
uses: docker/setup-qemu-action@v3
with:
platforms: all

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

- name: Log in to GHCR
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=raw,value=current-ubuntu
type=raw,value=latest

- name: Build and push
uses: docker/build-push-action@v6
with:
context: webui/current-ubuntu
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
46 changes: 46 additions & 0 deletions webui/current-ubuntu/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Bareos Web-ui Dockerfile
FROM ubuntu:noble

LABEL maintainer="barcus@tou.nu"

ARG BUILD_DATE
ARG NAME
ARG VCS_REF
ARG VERSION

LABEL org.label-schema.schema-version="1.0" \
org.label-schema.build-date=$BUILD_DATE \
org.label-schema.name=$NAME \
org.label-schema.vcs-ref=$VCS_REF \
org.label-schema.vcs-url="https://github.com/barcus/bareos" \
org.label-schema.version=$VERSION

# BareOS current (latest) for Ubuntu 24.04 (Noble) - Community Repository
ENV BAREOS_KEY=https://download.bareos.org/current/xUbuntu_24.04/Release.key
ENV BAREOS_REPO=https://download.bareos.org/current/xUbuntu_24.04/
ENV DEBIAN_FRONTEND=noninteractive

SHELL ["/bin/bash", "-o", "pipefail", "-c"]

RUN apt-get update -qq \
&& apt-get -qq -y install --no-install-recommends curl tzdata gnupg ca-certificates \
&& install -d /etc/apt/keyrings \
&& curl -fsSL $BAREOS_KEY | gpg --dearmor -o /etc/apt/keyrings/bareos.gpg \
&& echo "deb [signed-by=/etc/apt/keyrings/bareos.gpg] $BAREOS_REPO /" > /etc/apt/sources.list.d/bareos.list \
&& apt-get update -qq \
&& apt-get install -qq -y --no-install-recommends \
bareos-webui \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

COPY docker-entrypoint.sh /docker-entrypoint.sh
RUN chmod u+x /docker-entrypoint.sh

RUN tar czf /bareos-webui.tgz /etc/bareos-webui

EXPOSE 80

VOLUME /etc/bareos-webui

ENTRYPOINT ["/docker-entrypoint.sh"]
CMD ["/usr/sbin/apache2ctl", "-D", "FOREGROUND"]
25 changes: 25 additions & 0 deletions webui/current-ubuntu/docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/usr/bin/env bash

if [ ! -f /etc/bareos-webui/bareos-config.control ];then
tar xzf /bareos-webui.tgz --backup=simple --suffix=.before-control

# Update bareos-webui config
sed -i 's#diraddress.*#diraddress = '\""${BAREOS_DIR_HOST}"\"'#' \
/etc/bareos-webui/directors.ini

# Control file
touch /etc/bareos-webui/bareos-config.control
fi

apache_conf="/etc/apache2/sites-available/000-default.conf"

# Set document root
sed -i "s#/var/www/html#/usr/share/bareos-webui/public#g" $apache_conf

# Enable Apache server stats
if [ "${SERVER_STATS}" == "yes" ]; then
sed -i 's!#ServerName.*!Alias /server-status /var/www/dummy!' $apache_conf
fi

# Run Dockerfile CMD
exec "$@"