LibreBooking / docker

Librebooking as a docker container
GNU General Public License v3.0
11 stars 12 forks source link

RFE: Ability to build a locally modified version of LibreBooking #87

Closed JohnVillalovos closed 5 months ago

JohnVillalovos commented 5 months ago

Just a Request For Enhancement (RFE).

Would be nice if there was some easy way to build a locally modified version of LibreBooking into a container image.

My use case is that I am trying to debug some issues with the API, and would like to be able to make modifications and then regenerate the image.

My current technique is to make a new Dockerfile using this project's image (FROM librebooking/librebooking:develop) and then copy the modified files into the image and publish it locally. Maybe there is a better way to do this.

Thanks for making this project as it has been a big help for me! 👍

colisee commented 5 months ago

Hi @JohnVillalovos ,

What I would do is to make all my tests inside the container. Once you fix the issue, then you would be able to make a pull request in the upstream repository. Obviously, if you delete your container (ex: via docker compose down) then you also lose your modifications.

Another way is to change your docker-compose.yml and add volume(s) to override directories or file(s) from your host. Your changes will survive a container deletion.

JohnVillalovos commented 5 months ago

Thanks @colisee I'll give that a try.

JohnVillalovos commented 5 months ago

As a note I am currently doing this:

$ cat Dockerfile
FROM librebooking/librebooking:develop

COPY --chown=www-data:www-data librebooking/ /var/www/html/

The librebooking/ directory is my local copy of the LibreBooking source code with my changes.

I use this to create my own custom image. And then run it. This has been helpful for my debugging issues with the API.

colisee commented 5 months ago

I would suggest a more dynamic alternative by using the librebooking/docker image as-is and overriding the desired directory.

Assuming your $HOME directory contains the docker-compose.yml file and your Librebooking directory, I would change the volume section inside the docker-compose.yml file as follows:

    volumes:
      - vol-app:/config
      - ./Librebooking:/var/www/html

This way, you can modify the content of your host $HOME/Librebooking directory without the need to rebuild an image each time. Once you get what you want, you can push your modification to librebooking/app

JohnVillalovos commented 5 months ago

@colisee Thanks. That works if I have setup PHP and composer on the local system. And run composer against my Librebooking directory. In my case I didn't want to do that, so I was willing to put up with the regeneration of the Docker image. Which only took around 15-30 seconds.