Merge pull request #2 from mohamedbenhariz/feat-ssl

Feat ssl certificates
This commit is contained in:
mohamedbenhariz 2024-05-04 11:29:38 +02:00 committed by GitHub
commit a8795cba61
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 43 additions and 6 deletions

View File

@ -10,7 +10,9 @@ RUN chmod +x /healthcheck.sh # Make the script executable
HEALTHCHECK --start-period=2s --interval=5s --timeout=3s \
CMD /healthcheck.sh || exit 1
VOLUME /srv
RUN mkdir -p /Certs
VOLUME /srv /Certs
EXPOSE 80
COPY docker_config.json /.filebrowser.json

View File

@ -37,3 +37,31 @@ For installation instructions please refer to our docs at [https://filebrowser.o
## Contributing
If you're interested in contributing to this project, our docs are best places to start [https://filebrowser.org/contributing](https://filebrowser.org/contributing).
## Help for SSL Docker
To use SSL in Docker you must make this volumes configuration like this table
| Host/volume | Path in container | Description |
| :------------- | :------- | :-------------------------------- |
| `/home/devops/configFilebrowser/filebrowser.db` | `/filebrowser.db` | **Required**. for Database |
| `/home/devops/configFilebrowser/filebrowser.json` | `/filebrowser.json` | **Required**. for Configuration file (*) |
| `/home/devops/exemple.com` | `/Certs` | **Required**. for Certs |
| `/portainer/Downloads` | `/srv` | **Required**. Folder to be shared |
(*) and make the configuration in json file like this
```http
{
"port": 8080, //the same port as your host container
"baseURL": "",
"address": "exemple.com",
"log": "stdout",
"database": "/filebrowser.db",
"root": "/srv",
"cert": "/Certs/fullchain.pem",
"key": "/Certs/privkey.pem"
}
```

View File

@ -3,6 +3,8 @@
"baseURL": "",
"address": "",
"log": "stdout",
"database": "/database.db",
"root": "/srv"
"database": "/filebrowser.db",
"root": "/srv",
"cert": "/Certs/fullchain.pem",
"key": "/Certs/privkey.pem"
}

View File

@ -1,5 +1,10 @@
#!/bin/sh
PORT=${FB_PORT:-$(jq -r .port /.filebrowser.json)}
ADDRESS=${FB_ADDRESS:-$(jq -r .address /.filebrowser.json)}
PORT=${FB_PORT:-$(jq -r .port filebrowser.json)}
ADDRESS=${FB_ADDRESS:-$(jq -r .address filebrowser.json)}
ADDRESS=${ADDRESS:-localhost}
curl -f http://$ADDRESS:$PORT/health || exit 1
VAR=$(jq -r .cert filebrowser.json)
if [ -z "${VAR}" ]; then
curl -f http://$ADDRESS:$PORT/health || exit 1
else
curl -f https://$ADDRESS:$PORT/health || exit 1
fi