1
0
mirror of https://github.com/Rouji/single_php_filehost.git synced 2025-04-04 16:39:34 +00:00

Added configuration for Docker

This commit is contained in:
MuratovAS 2021-12-12 15:51:13 +05:00
parent 5747e1dbd7
commit 4ee906b92f
No known key found for this signature in database
GPG Key ID: AC356035D45A17DE
6 changed files with 2057 additions and 0 deletions

46
Dockerfile Normal file
View File

@ -0,0 +1,46 @@
FROM alpine:latest
RUN apk --update \
add lighttpd && \
rm -rf /var/cache/apk/*
ADD lighttpd.conf /etc/lighttpd/lighttpd.conf
RUN adduser www-data -G www-data -H -s /bin/false -D
RUN apk --update add \
php \
php-common \
php-cgi \
php-dom && \
rm -rf /var/cache/apk/*
#php-iconv \
#php-json \
#php-gd \
#php-curl \
#php-xml \
#php-simplexml \
#php-pgsql \
#php-imap \
#fcgi \
#php-pdo \
#php-pdo_pgsql \
#php-soap \
#php-xmlrpc \
#php-posix \
#php-gettext \
#php-ldap \
#php-ctype \
RUN mkdir -p /run/lighttpd/ && \
chown www-data. /run/lighttpd/
ADD lighttpd.conf /etc/lighttpd/lighttpd.conf
ADD index.php /var/www/index.php
ADD php.ini /etc/php7/php.ini
EXPOSE 80
VOLUME /var/www
WORKDIR /var/www
CMD lighttpd -D -f /etc/lighttpd/lighttpd.conf

7
Makefile Normal file
View File

@ -0,0 +1,7 @@
build:
mkdir -p files
docker build -t lightphp .
start:
sudo docker-compose up -d
stop:
sudo docker-compose rm -s

View File

@ -63,3 +63,18 @@ $file_max_age = $MIN_FILEAGE +
```
...which is a basic exponential decay curve that favours smaller files, meaning small files are kept longer and really big ones are deleted relatively quickly.
**$DECAY_EXP** is one of the configurable globals and basically makes the curve more or less exponential-looking. Set to 1 for a completely linear relationship.
# Using Docker
Easy way to deploy services.
Configuration allows you to start a server for 80 of your host.
The image is built on Alpine + Lighttpd and a minimal PHP set. Image size 21MB.
Installation
```
make build
make start
```
To purge the old files, add string to your crontab string
```
0 0 * * * docker exec --user www-data lightphp php index.php purge > /dev/null
```

15
docker-compose.yml Normal file
View File

@ -0,0 +1,15 @@
version: '3'
services:
app:
image: "lightphp"
container_name: lightphp
restart: always
ports:
- "80:80"
volumes:
- ./files:/var/www/files
# OR
#- ./www:/var/www
#- ./lighttpd:/etc/lighttpd
#- ./php7:/etc/php7

27
lighttpd.conf Normal file
View File

@ -0,0 +1,27 @@
server.document-root = "/var/www/"
server.port = 80
server.username = "www-data"
server.groupname = "www-data"
mimetype.assign = (
".html" => "text/html",
".htm" => "text/html",
".txt" => "text/plain",
".jpg" => "image/jpeg",
".png" => "image/png",
".gif" => "image/gif",
".ico" => "image/vnd.microsoft.icon"
)
include "mod_fastcgi.conf"
static-file.exclude-extensions = ( ".fcgi", ".php", ".rb", "~", ".inc" )
index-file.names = ( "index.html", "index.htm" , "index.php")
server.modules += ( "mod_rewrite" )
url.rewrite = (
"^/?$" => "/index.php",
"^/(.*)$" => "/files/$1"
)

1947
php.ini Normal file

File diff suppressed because it is too large Load Diff