Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
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
36 changes: 36 additions & 0 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Publish Docker image

on:
push:
branches:
- master

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v3
with:
submodules: true

- name: Log in to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

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

- name: Build Docker image
run: |
repo_name=$(echo "${{ github.repository }}" | tr '[:upper:]' '[:lower:]')
docker build -t ghcr.io/${repo_name}/dvb-i-reference-client:latest .

- name: Push Docker image to GitHub Container Registry
run: |
repo_name=$(echo "${{ github.repository }}" | tr '[:upper:]' '[:lower:]')
docker push ghcr.io/${repo_name}/dvb-i-reference-client:latest
6 changes: 6 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
FROM php:8.1-apache

COPY ./ /var/www/html/

RUN a2enmod rewrite
RUN a2enmod expires
2 changes: 1 addition & 1 deletion backend/configuration.php
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using environment variable to set the $install_location in the backend might be problematic outside the docker container. As far as I understand, the environment variables need to be configured on the web server level ( apache or nginx php configuration ). If the backend is used form a user directory they may not have the option to change the web server configuration and if there are multiple users in the same domain then they would need different environment variables.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

perhaps something like this would be a good way for both use cases? use the environment variable and there is a fallback value if the environment variable is not set?

<?php
//
// install_location is the installation directory
// see also frontend/configuration.js
//

//Docker uses install location from environment variable
if(isset($_ENV['INSTALL_LOCATION'])) {
  $install_location = $_ENV['INSTALL_LOCATION']
}
else {
  //configure install location here if used without docker
  $install_location = "https://dvb-i-reference.dvb.org/client";
}
?>

Perhaps the environment variable name should be more specific to avoid possible collisions? Maybe "DVB_I_INSTALL_LOCATION"?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We also need to deal with frontend/confiiguration.js which currently has the absolute URL to the installed backend. If the backend and frontend are both running in the same machine, then 'localhost' can be used - but this is seldom the situation

Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
// install_location is the installation directory
// see also frontend/configuration.js
//
$install_location = "https://dvb-i-reference.dvb.org/client";
$install_location = $_ENV['INSTALL_LOCATION'];
?>
2 changes: 1 addition & 1 deletion frontend/configuration.js
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefer to see a solution where this file (and probably backend/configuration.php also) can be used in different scenarios. This change means that the frontend and backend are running in the same container - ideally the backend should run in the container and provide the separate frontend client with INSTALL_LOCATION in frontend/configuration.js based on the container address

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// DVB-I Reference installation location -- also backend/configuration.php
var INSTALL_LOCATION = "https://dvb-i-reference.dvb.org/client";
var INSTALL_LOCATION = "http://localhost:8888";

// set to true to include <Service> channels that are not included in the selected LCN table.
var INCLUDE_NON_LCN_CHANNELS = false;