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..8992c70 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,6 @@ +FROM php:8.1-apache + +COPY ./ /var/www/html/client + +RUN a2enmod rewrite +RUN a2enmod expires 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). 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/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..a6f670d --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,13 @@ +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 + # Uncomment volumes if you want to use the source code rather than use from docker image + # volumes: + # - ./:/var/www/html/client + environment: + - INSTALL_LOCATION=${INSTALL_LOCATION:-http://localhost:8888/client} + ports: + - "8888:80" diff --git a/frontend/configuration.js b/frontend/configuration.js index 34d6822..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 = "https://dvb-i-reference.dvb.org/client"; +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;