Skip to content

Instantly share code, notes, and snippets.

@halomakes
Last active August 30, 2022 17:20
Show Gist options
  • Save halomakes/4b92ca454e381d41ca33ae74034e988c to your computer and use it in GitHub Desktop.
Save halomakes/4b92ca454e381d41ca33ae74034e988c to your computer and use it in GitHub Desktop.
FileBrowser Docker

Build the image. Uploads set to 100M max size to keep cloudflare happy. You can adjust chunk size in the configuration.php file.

docker build -t filebrowser:test .

Run that sucker

docker run -p 80:80 \
 -v /path/to/configuration.php:/var/www/filebrowser/configuration.php \
 -v /path/to/files/:/var/www/filebrowser/repository/ \
 -d --name filebrowser \
 filebrowser:test
FROM alpine:latest as unzipper
RUN apk add unzip wget curl
RUN mkdir /download/
RUN mkdir /download/output/
RUN wget -O /download/file.zip https://filebrowser.linuxforphp.net/files/filebrowser-8.0.2.zip
RUN unzip /download/file.zip -d /download/output/
FROM php:7.4-apache
RUN apt update
RUN apt install zip unzip
COPY --from=unzipper /download/output/ /var/www/
RUN chown -R www-data:www-data /var/www/filebrowser/
RUN chmod -R 775 /var/www/filebrowser/
RUN sed -i 's/post_max_size.*/post_max_size = 100M/g' "$PHP_INI_DIR/php.ini-production"
RUN sed -i 's/upload_max_filesize.*/upload_max_filesize = 100M/g' "$PHP_INI_DIR/php.ini-production"
RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini"
WORKDIR /var/www/html
COPY . .
RUN echo "\n<VirtualHost *:80>\n DocumentRoot /var/www/filebrowser/dist\n LimitRequestBody 104857600\n</VirtualHost>\n" >> /etc/apache2/sites-available/filebrowser.conf
RUN a2dissite 000-default
RUN a2ensite filebrowser
RUN service apache2 restart
EXPOSE 80
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment