mirror of
https://github.com/misterunknown/ifm.git
synced 2025-08-12 02:53:58 +02:00
Up to v2.6.0
==== - [=] [Bootstrap](https://getbootstrap.com/docs/4.4/) updated from 3.4.1 to 4.4.1 - [=] [Bootstrap Menu](https://github.com/cryol/bootstrap-menu) fork and refactoring - [=] [Datatables](https://datatables.net/) change bs to bs4 v1.10.20 - [=] Rewrite templates to bs4. - [=] Rewrite compiler - CDN/NON-CDN exclude to assets.part/assets.cdn.part.
This commit is contained in:
committed by
Marco Dickert
parent
a7d5d46f54
commit
e76da46aa9
3
docker/.dockerignore
Normal file
3
docker/.dockerignore
Normal file
@@ -0,0 +1,3 @@
|
||||
*
|
||||
!ifm.php
|
||||
!docker-startup.sh
|
34
docker/Dockerfile
Normal file
34
docker/Dockerfile
Normal file
@@ -0,0 +1,34 @@
|
||||
FROM php:7-cli-alpine
|
||||
|
||||
# only necessary environment variables
|
||||
ENV IFM_ROOT_DIR="/var/www" \
|
||||
IFM_ROOT_PUBLIC_URL="/www" \
|
||||
IFM_TMP_DIR="/tmp"
|
||||
|
||||
# add missing extensions and dependencies
|
||||
RUN apk add --no-cache libbz2 libzip libcap sudo && \
|
||||
apk add --no-cache --virtual .php-extension-build-deps bzip2 bzip2-dev libzip-dev && \
|
||||
docker-php-ext-install bz2 zip && \
|
||||
apk del --no-cache --purge .php-extension-build-deps
|
||||
|
||||
# allow php binary to bind ports <1000, even if $USER != root
|
||||
RUN /usr/sbin/setcap CAP_NET_BIND_SERVICE=+eip /usr/local/bin/php
|
||||
|
||||
# remove unnecessary users
|
||||
RUN deluser xfs && \
|
||||
deluser www-data
|
||||
|
||||
# sudo: workaround for https://bugzilla.redhat.com/show_bug.cgi?id=1773148
|
||||
RUN echo "Set disable_coredump false" > /etc/sudo.conf
|
||||
|
||||
# prepare files
|
||||
RUN rm -rf /var/www/html && \
|
||||
mkdir -p /usr/local/share/webapps/ifm && \
|
||||
ln -s /var/www /usr/local/share/webapps/ifm/www
|
||||
COPY ifm.php /usr/local/share/webapps/ifm/index.php
|
||||
COPY docker-startup.sh /usr/local/bin
|
||||
|
||||
# start php server
|
||||
WORKDIR /usr/local/share/webapps/ifm
|
||||
EXPOSE 80
|
||||
CMD /usr/local/bin/docker-startup.sh
|
35
docker/docker-startup.sh
Normal file
35
docker/docker-startup.sh
Normal file
@@ -0,0 +1,35 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
if [ ! -z $IFM_DOCKER_UID ]; then
|
||||
# check if UID/GID are numeric
|
||||
if ! echo "$IFM_DOCKER_UID$IFM_DOCKER_GID" | egrep "^[0-9]+$" >/dev/null 2>&1; then
|
||||
echo "FATAL: IFM_DOCKER_UID or IFM_DOCKER_GID are not numeric (UID: $IFM_DOCKER_UID, GID: $IFM_DOCKER_GID)"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# get GID if not set
|
||||
if [ -z $IFM_DOCKER_GID ]; then
|
||||
export IFM_DOCKER_GID=$IFM_DOCKER_UID
|
||||
fi
|
||||
|
||||
# delete user if already exists
|
||||
if getent passwd $IFM_DOCKER_UID >/dev/null 2>&1; then
|
||||
deluser $(getent passwd $IFM_DOCKER_UID | sed "s/:.*//")
|
||||
fi
|
||||
|
||||
# check if group already exists
|
||||
if ! getent group $IFM_DOCKER_GID >/dev/null 2>&1; then
|
||||
addgroup -g $IFM_DOCKER_GID -S www-data
|
||||
REAL_GROUP=www-data
|
||||
else
|
||||
REAL_GROUP=$(getent group $IFM_DOCKER_GID | sed "s/:.*//")
|
||||
fi
|
||||
|
||||
adduser -u $IFM_DOCKER_UID -SHDG $REAL_GROUP www-data
|
||||
else
|
||||
addgroup -g 33 -S www-data
|
||||
adduser -SHD -u 33 -G www-data www-data
|
||||
fi
|
||||
|
||||
sudo -Eu www-data /usr/local/bin/php -S 0:80 -t /usr/local/share/webapps/ifm
|
Reference in New Issue
Block a user