Move to PHP83 as PHP distribution, update documentation
All checks were successful
/ build (push) Successful in 1m15s

This commit is contained in:
Varakh 2024-11-01 11:09:16 +01:00
parent 3b1f79dce9
commit 04a5ba3a3d
6 changed files with 97 additions and 76 deletions

View file

@ -1,5 +1,10 @@
# CHANGELOG # CHANGELOG
## 2024-11-01
* Move to PHP83
* Update documentation
## 2024-04-14 ## 2024-04-14
* Update to FileBin `4.0.2` * Update to FileBin `4.0.2`

View file

@ -1,7 +1,7 @@
# #
# Build image # Build image
# #
FROM alpine:3 as builder FROM alpine:3.20 as builder
ARG FB_VERSION ARG FB_VERSION
ARG FB_SOURCE_URL="https://github.com/Bluewind/filebin" ARG FB_SOURCE_URL="https://github.com/Bluewind/filebin"
@ -22,7 +22,7 @@ RUN apk add --update --no-cache git && \
git clone --branch ${FB_VERSION} "${FB_SOURCE_URL}" --depth=${FB_CLONE_DEPTH} /app/fb_src && \ git clone --branch ${FB_VERSION} "${FB_SOURCE_URL}" --depth=${FB_CLONE_DEPTH} /app/fb_src && \
rm -rf /app/fb_src/.git rm -rf /app/fb_src/.git
FROM alpine:3 FROM alpine:3.20
COPY --from=builder /app/fb_src /var/www COPY --from=builder /app/fb_src /var/www
LABEL maintainer="Varakh <varakh@varakh.de>" \ LABEL maintainer="Varakh <varakh@varakh.de>" \
@ -92,27 +92,27 @@ RUN chmod -x /wait-for.sh && \
ghostscript \ ghostscript \
msmtp \ msmtp \
composer \ composer \
php81 \ php83 \
php81-fpm \ php83-fpm \
php81-intl \ php83-intl \
php81-curl \ php83-curl \
php81-dom \ php83-dom \
php81-pcntl \ php83-pcntl \
php81-posix \ php83-posix \
php81-session \ php83-session \
php81-gd \ php83-gd \
php81-exif \ php83-exif \
php81-phar \ php83-phar \
php81-pdo \ php83-pdo \
php81-pgsql \ php83-pgsql \
php81-pdo_pgsql \ php83-pdo_pgsql \
php81-pdo_mysql \ php83-pdo_mysql \
php81-mysqli \ php83-mysqli \
php81-fileinfo \ php83-fileinfo \
php81-mbstring \ php83-mbstring \
php81-ctype \ php83-ctype \
php81-ldap \ php83-ldap \
php81-pecl-memcached \ php83-pecl-memcached \
memcached \ memcached \
ca-certificates && \ ca-certificates && \
rm -rf /var/cache/apk/* && \ rm -rf /var/cache/apk/* && \
@ -120,16 +120,16 @@ RUN chmod -x /wait-for.sh && \
# prepare www dir # prepare www dir
cp -r /var/www/application/config/example/* /var/www/application/config && \ cp -r /var/www/application/config/example/* /var/www/application/config && \
# set environments # set environments
sed -i "s|;*memory_limit =.*|memory_limit = ${PHP_MEMORY_LIMIT}|i" /etc/php81/php.ini && \ sed -i "s|;*memory_limit =.*|memory_limit = ${PHP_MEMORY_LIMIT}|i" /etc/php83/php.ini && \
sed -i "s|;*upload_max_filesize =.*|upload_max_filesize = ${MAX_UPLOAD}|i" /etc/php81/php.ini && \ sed -i "s|;*upload_max_filesize =.*|upload_max_filesize = ${MAX_UPLOAD}|i" /etc/php83/php.ini && \
sed -i "s|;*max_file_uploads =.*|max_file_uploads = ${PHP_MAX_FILE_UPLOAD}|i" /etc/php81/php.ini && \ sed -i "s|;*max_file_uploads =.*|max_file_uploads = ${PHP_MAX_FILE_UPLOAD}|i" /etc/php83/php.ini && \
sed -i "s|;*post_max_size =.*|post_max_size = ${PHP_MAX_POST}|i" /etc/php81/php.ini && \ sed -i "s|;*post_max_size =.*|post_max_size = ${PHP_MAX_POST}|i" /etc/php83/php.ini && \
sed -i 's+.*sendmail_path =.*+sendmail_path = "/usr/bin/msmtp -C /var/www/msmtprc --logfile /var/www/msmtp.log -a filebinmail -t"+' /etc/php81/php.ini && \ sed -i 's+.*sendmail_path =.*+sendmail_path = "/usr/bin/msmtp -C /var/www/msmtprc --logfile /var/www/msmtp.log -a filebinmail -t"+' /etc/php83/php.ini && \
# clean up and permissions # clean up and permissions
rm -rf /var/cache/apk/* && \ rm -rf /var/cache/apk/* && \
chown nobody:nginx -R /var/www && \ chown nobody:nginx -R /var/www && \
rm /usr/bin/php && \ rm /usr/bin/php && \
ln -s /usr/bin/php81 /usr/bin/php ln -s /usr/bin/php83 /usr/bin/php
# Add nginx config # Add nginx config
ADD src/filebin.nginx.conf /etc/nginx/nginx.conf ADD src/filebin.nginx.conf /etc/nginx/nginx.conf

View file

@ -2,45 +2,85 @@
A docker image for [FileBin](https://git.server-speed.net/users/flo/filebin/) to have it up and running in seconds. A docker image for [FileBin](https://git.server-speed.net/users/flo/filebin/) to have it up and running in seconds.
Visit project on [https://git.myservermanager.com/varakh/docker-filebin](https://git.myservermanager.com/varakh/docker-filebin) Visit project
on [https://git.myservermanager.com/varakh/docker-filebin](https://git.myservermanager.com/varakh/docker-filebin)
or [Docker Hub](https://hub.docker.com/r/varakh/filebin). or [Docker Hub](https://hub.docker.com/r/varakh/filebin).
The main git repository is hosted at _[https://git.myservermanager.com/varakh/docker-filebin](https://git.myservermanager.com/varakh/docker-filebin)_. The main git repository is hosted at
_[https://git.myservermanager.com/varakh/docker-filebin](https://git.myservermanager.com/varakh/docker-filebin)_.
Other repositories are mirrors and pull requests, issues, and planning are managed there. Other repositories are mirrors and pull requests, issues, and planning are managed there.
Contributions are very welcome! Contributions are very welcome!
## Getting started ## Getting started
The recommended way to get started is to use the example `docker-compose.yml` file and use *Docker*. Before, make There's an example [`docker-compose.yml`](./docker-compose.yml) file to get started quickly. Before, make
yourself familiar with the environment variables which can be set. Defaults should do as a starting point. yourself familiar with the environment variables which can be set. Defaults should do as a starting point.
_Be sure to read persisting volumes_ section and execute the required command. _Be sure to read persisting volumes_ section and execute the required command.
Default database is PostgreSQL. Other databases are supported and can be configured via exposed environment variables. Default database is Postgres. Other databases are supported and can be configured via exposed environment variables.
Please refer to the original documentation of the application for further details. PHP modules for MySQL are included in Please refer to the original documentation of the application for further details. PHP modules for MySQL are included in
the image. the image.
After your database and the application docker container is up and running, add a first user by executing a command After your database and the application docker container is up and running, add a first user by executing a command
within the docker container: within the docker container:
``` ```shell
docker exec -it filebin_app /bin/sh # docker
docker exec -it filebin_app sh
# podman
podman exec -it filebin_app sh
# inside container
php /var/www/index.php user add_user php /var/www/index.php user add_user
``` ```
_Alternatively_ you can also use *Podman* for a root-less deployment, e.g. with something similar to: _Alternatively_ you can also use *Podman* for deployment, e.g. with something similar to:
``` ```shell
podman run -e POSTGRES_PASSWORD=fb -e POSTGRES_USER=fb -e POSTGRES_DB=fb -p 5432:5432 docker.io/postgres:11 # create recommended volumes
podman run -e BASE_URL=http://localhost:8080 -e DB_HOST=your_host -e DB_PORT=5432 -e DB_NAME=fb -e DB_USER=fb -e DB_PASS=fb -e ENCRYPTION_KEY=your_32_long_secret -p 8080:80 docker.io/varakh/filebin:latest podman volume create fb-data-vol
podman volume create fb-db-vol
# create pod, making it available on localhost only
podman pod create -n filebin -p '127.0.0.1:8080:80'
# start database container
podman run -d --name filebin_db \
--pod filebin
-v fb-db-vol:/var/lib/postgresql/data \
-e POSTGRES_PASSWORD=fb \
-e POSTGRES_USER=fb \
-e POSTGRES_DB=fb \
docker.io/postgres:15
# start application container
# - generate ENCRYPTION_KEY key via 'openssl rand -hex 16'
# - adapt 'BASE_URL' to your public domain
podman run -d --name filebin_app \
--pod filebin \
-v fb-data-vol:/var/www/data/uploads \
-e ENCRYPTION_KEY=<your_32_long_secret> \
-e BASE_URL=http://localhost:8080 \
-e DB_HOST=localhost \
-e DB_PORT=5432 \
-e DB_NAME=fb \
-e DB_USER=fb \
-e DB_PASS=fb \
docker.io/varakh/filebin:latest
``` ```
### Persisting volumes ### Persisting volumes
You'll probably want the `uploads/` folder to be persistent across container restarts. > Postgres data should also be persisted. Please look into the above examples or consult Postgres docker image
> documentation.
Here's an example on how to persist the `data/uploads/` folder of the application. You'll probably want FileBin's `uploads/` folder to be persistent across container restarts.
Here's an example on how to persist the `data/uploads/` folder of the application with a host bind. You can also use
actual volumes for that.
* Create folder: `mkdir -p ./filebin_data` * Create folder: `mkdir -p ./filebin_data`
* Afterward, adjust permissions so that the folder can be used within the docker * Afterward, adjust permissions so that the folder can be used within the docker

View file

@ -1,5 +1,3 @@
version: "3"
networks: networks:
fb: fb:
external: false external: false
@ -13,7 +11,8 @@ services:
- POSTGRES_USER=fb - POSTGRES_USER=fb
- POSTGRES_DB=fb - POSTGRES_DB=fb
volumes: volumes:
- ./filebin_db/:/var/lib/postgresql/data # persist postgres data on the host # persist postgres data on host in current directory, you can also switch to actual volumes
- ./filebin_db/:/var/lib/postgresql/data
restart: always restart: always
networks: networks:
- fb - fb
@ -24,17 +23,21 @@ services:
depends_on: depends_on:
- db - db
ports: ports:
- "127.0.0.1:8080:80" # exposed port :80 mapped to :8080 on only this host. 8080 should then be used in proxy # exposed port :80 mapped to :8080 on only this host. 8080 should then be used in proxy
- "127.0.0.1:8080:80"
environment: environment:
- BASE_URL=https://fb.domain.tld/ # with trailing slash # with trailing slash
- BASE_URL=https://fb.domain.tld/
- DB_HOST=db - DB_HOST=db
- DB_PORT=5432 - DB_PORT=5432
- DB_NAME=fb - DB_NAME=fb
- DB_USER=fb - DB_USER=fb
- DB_PASS=fb - DB_PASS=fb
- ENCRYPTION_KEY= # REQUIRED: set a 32 character long sequence # REQUIRED: set a 32 character long sequence, e.g. with 'openssl rand -hex 16'
- ENCRYPTION_KEY=
volumes: volumes:
- "./filebin_data:/var/www/data/uploads" # persist filebin data on the host # persist filebin data on host in current directory, you can also switch to actual volumes
- "./filebin_data:/var/www/data/uploads"
stdin_open: true stdin_open: true
tty: true tty: true
restart: always restart: always

View file

@ -1,27 +0,0 @@
#!/usr/bin/env bash
set -e;
if [[ -v FB_VERSION ]]; then
echo "Processing with version ${FB_VERSION}"
else
echo "Set FB_VERSION before calling this script"
exit 1;
fi
BUILD_DIR="fb_src"
if [[ ! -d "${BUILD_DIR}" ]]; then
mkdir -p "${BUILD_DIR}";
echo "Created ${BUILD_DIR}"
else
rm -rf "${BUILD_DIR}";
mkdir -p "${BUILD_DIR}";
echo "Re-created ${BUILD_DIR}"
fi
git clone --branch ${FB_VERSION} https://github.com/Bluewind/filebin --depth=1 "${BUILD_DIR}";
sudo docker build --no-cache -t varakh/filebin:${FB_VERSION} -t varakh/filebin:latest .;

View file

@ -1,3 +1,3 @@
#!/bin/sh #!/bin/sh
exec /usr/sbin/php-fpm81 --nodaemonize exec /usr/sbin/php-fpm83 --nodaemonize