From aebc3b19c2cac1d2f044dc2f6d1cbde75e78a22c Mon Sep 17 00:00:00 2001 From: Rafael Bermudez Guijo Date: Thu, 30 Jan 2025 10:17:44 +0100 Subject: [PATCH 1/5] build: Build with Docker --- .github/workflows/docker-publish.yml | 36 ++++++++++++++++++++++++++++ Dockerfile | 6 +++++ backend/configuration.php | 2 +- frontend/configuration.js | 2 +- 4 files changed, 44 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/docker-publish.yml create mode 100644 Dockerfile diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml new file mode 100644 index 0000000..7080752 --- /dev/null +++ b/.github/workflows/docker-publish.yml @@ -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 diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..3792944 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,6 @@ +FROM php:8.1-apache + +COPY ./ /var/www/html/ + +RUN a2enmod rewrite +RUN a2enmod expires diff --git a/backend/configuration.php b/backend/configuration.php index 2dab616..35e890a 100755 --- a/backend/configuration.php +++ b/backend/configuration.php @@ -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']; ?> diff --git a/frontend/configuration.js b/frontend/configuration.js index 34d6822..a5311e3 100644 --- a/frontend/configuration.js +++ b/frontend/configuration.js @@ -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 channels that are not included in the selected LCN table. var INCLUDE_NON_LCN_CHANNELS = false; From 98db224b0460af8944c92d9b6c71a991ef60dd60 Mon Sep 17 00:00:00 2001 From: Rafael Bermudez Guijo Date: Thu, 30 Jan 2025 10:24:39 +0100 Subject: [PATCH 2/5] build: Prepare for docker run --- frontend/configuration.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/configuration.js b/frontend/configuration.js index a5311e3..a32819d 100644 --- a/frontend/configuration.js +++ b/frontend/configuration.js @@ -1,5 +1,5 @@ // DVB-I Reference installation location -- also backend/configuration.php -var INSTALL_LOCATION = "http://localhost:8888"; +var INSTALL_LOCATION = ""; // set to true to include channels that are not included in the selected LCN table. var INCLUDE_NON_LCN_CHANNELS = false; From 41fa4c8fa81bcb89918b677fca3740b7eb5d27ce Mon Sep 17 00:00:00 2001 From: Rafael Bermudez Guijo Date: Thu, 30 Jan 2025 10:26:14 +0100 Subject: [PATCH 3/5] chore: add docker compose to simplify running --- docker-compose.yml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 docker-compose.yml diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..00c898e --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,14 @@ +version: '1.0' +services: + dvb-i-reference-client: + # Comment build and uncomment image if you want to use prebuilt image rather than build from the source code + #build: . + image: ghcr.io/ccma-enginyeria/dvb-i-reference-client/dvb-i-reference-client:latest + # Comment volumes if you want to use your own code rather than use from docker image + volumes: + - ./:/var/www/html/ + environment: + - no_proxy=localhost,127.0.0.1 + - INSTALL_LOCATION=http://localhost:8888 + ports: + - "8888:80" From ae13692081ff6f1768ce9923166acd9ba85e4a77 Mon Sep 17 00:00:00 2001 From: Rafael Bermudez Guijo Date: Thu, 30 Jan 2025 11:20:54 +0100 Subject: [PATCH 4/5] build: Move default location to /client to mantain compatibility --- Dockerfile | 2 +- docker-compose.yml | 11 +++++------ frontend/configuration.js | 2 +- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/Dockerfile b/Dockerfile index 3792944..8992c70 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,6 @@ FROM php:8.1-apache -COPY ./ /var/www/html/ +COPY ./ /var/www/html/client RUN a2enmod rewrite RUN a2enmod expires diff --git a/docker-compose.yml b/docker-compose.yml index 00c898e..a6f670d 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -2,13 +2,12 @@ version: '1.0' services: dvb-i-reference-client: # Comment build and uncomment image if you want to use prebuilt image rather than build from the source code - #build: . + # build: . image: ghcr.io/ccma-enginyeria/dvb-i-reference-client/dvb-i-reference-client:latest - # Comment volumes if you want to use your own code rather than use from docker image - volumes: - - ./:/var/www/html/ + # Uncomment volumes if you want to use the source code rather than use from docker image + # volumes: + # - ./:/var/www/html/client environment: - - no_proxy=localhost,127.0.0.1 - - INSTALL_LOCATION=http://localhost:8888 + - INSTALL_LOCATION=${INSTALL_LOCATION:-http://localhost:8888/client} ports: - "8888:80" diff --git a/frontend/configuration.js b/frontend/configuration.js index a32819d..63d5e19 100644 --- a/frontend/configuration.js +++ b/frontend/configuration.js @@ -1,5 +1,5 @@ // DVB-I Reference installation location -- also backend/configuration.php -var INSTALL_LOCATION = ""; +var INSTALL_LOCATION = "/client"; // set to true to include channels that are not included in the selected LCN table. var INCLUDE_NON_LCN_CHANNELS = false; From 8d2923bceafc4b59cd3c4764c2d427469a7ebadb Mon Sep 17 00:00:00 2001 From: Rafael Bermudez Guijo Date: Thu, 30 Jan 2025 11:21:43 +0100 Subject: [PATCH 5/5] docs: Added documentation for docker alternative --- README.md | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/README.md b/README.md index 789d19f..e81ba80 100755 --- a/README.md +++ b/README.md @@ -80,3 +80,50 @@ This will create opapp.pkg in the project root directory. Edit the [XML AIT](htt Backend is deployable to any web server with PHP support. Make sure that the "servicelists" directory is writable. The backend stores new servicelists there. NOTE: The frontend uses "example.xml" as the service list. It can be browsed in the Backend editor as well, but not modified. [https://dvb-i-reference.dvb.org/client/backend/servicelists/example.xml](https://dvb-i-reference.dvb.org/client/backend/servicelists/example.xml) + +## Installation Alternative with Docker + +For ease of deployment and development, you can utilize Docker to run the DVB-I Reference Application. This method allows you to quickly set up an environment without requiring manual configuration. + +### Prerequisites + +Before proceeding, ensure that you have the following installed on your system: +- [Docker](https://docs.docker.com/get-docker/) +- [Docker Compose](https://docs.docker.com/compose/install/) + +### Steps for Docker Deployment + +1. **Clone the Repository**: + Begin by cloning the repository to your local machine. + ```bash + git clone https://github.com/DVBProject/DVB-I-Reference-Client.git + cd DVB-I-Reference-Client + ``` + +2. **Run Docker Containers**: + Use the provided `docker-compose.yml` file to run the container. + ```bash + docker-compose up -d + ``` + +3. **Access the Application**: + Once the containers are up and running, you can access the DVB-I Reference Application by navigating to [http://localhost:8888/client](http://localhost:8888/client) in your web browser. + +### Development Mode with Docker Volumes + +If you prefer to work in a development mode, where changes to the source code are reflected immediately, you can use Docker volumes: + +1. **Uncomment volume mapping at docker-compose.yml**: + ```yml + volumes: + - ./:/var/www/html/client + ``` + +2. **Run Docker Containers**: + Use the modified `docker-compose.yml` file to run the container. + ```bash + docker-compose up -d + ``` + +3. **Access the Application**: + Continue to access the application via [http://localhost:8888/client](http://localhost:8888/client).