hurlenko/filebrowser-docker

Hardcoded properties

Opened this issue · 3 comments

The next command in Dockerfile makes impossible to re-map the folders structure

CMD ["--root=/data", "--address=0.0.0.0", "--database=/config/filebrowser.db"]

Example of real life issue: I've tried to deploy this to fly.io, but it allows to mount only 1 volume.
I've solved this issue by removing this command and slightly modifying your Dockerfile + starting from custom .sh entrypoint to have ability to make some initial preparations.

Proposal:

  1. Remove root, address, database hardcoded setup
  2. Make ENTRYPOINT ["/start.sh"] instead of direct ["/filebrowser"] call

That's what I've actually did

In my case my folders structure is
root: /data/data
database: /data/config/filebrowser.db

So I can mount single /data directory.
In .sh script I create /data/data directory so FileBrowser can find it.

You can override both the ENTRYPOINT and CMD parts of a dockertfile when running a container:

docker run -v /mydir:/mydir --entrypoint=/mydir/start.sh hurlenko/filebrowser --root=/mydir/data --database=/mydir/config/filebrowser.db

I have no experience with fly.io, not sure if it is possible to do this via their platform. As for the proposals - I believe it might break existing setups, don't really want to do that.

You don't run docker command when deploy to fly.io, so unfortunately that's not an option.
I will stay with my own build then based on your Dockerfile and get.sh.

I think you can fix that so it will work for old users. Just add .filebrowser.yaml

version: 3
address: 0.0.0.0
root: /data
database: /config/filebrowser.db

And copy it in Dockerfile

COPY /.filebrowser.yaml /.filebrowser.yaml

The priority listed here https://filebrowser.org/cli/filebrowser will let us override properties easily with ENVs or replace .filebrowser.yaml in simple Dockerfile not recreating whole workflow just to set own variables.
Those users who did not do this setup will still have the same properties you did, but with ability to override using different techniques like set another config with flag, replace .filebrowser.yaml with own, use ENVs.

Flags have highest priority that makes your image braking original customisation. So, that was my suggestion how to fix that.

Just an example of my props. I've also added Nginx to the image to use another subpath.
host/browser/ - filebrowser
host/shared/ - proxied direct link to content in shared folder

root: /data/data
database: /data/config/database.db

As I mentioned, this config lets me mount one single volume.