mirror of
https://github.com/nokonoko/Uguu.git
synced 2024-01-06 13:35:15 +00:00
docker support added
using alpine for the docker instead of ubuntu cuts the size and installation time by quite a bit
This commit is contained in:
parent
c37c18d723
commit
b3c0237ad9
@ -3,7 +3,7 @@
|
|||||||
"allowErrors": false
|
"allowErrors": false
|
||||||
},
|
},
|
||||||
"dest": "dist",
|
"dest": "dist",
|
||||||
"pkgVersion": "1.5.2",
|
"pkgVersion": "1.5.3",
|
||||||
"banners": [
|
"banners": [
|
||||||
"banners/malware_scans.swig",
|
"banners/malware_scans.swig",
|
||||||
"banners/donations.swig"
|
"banners/donations.swig"
|
||||||
|
@ -2,8 +2,8 @@ GEN_ROBOTS_TXT=false
|
|||||||
GEN_SITE_MAP=false
|
GEN_SITE_MAP=false
|
||||||
MAX_UPLOAD_SIZE=128
|
MAX_UPLOAD_SIZE=128
|
||||||
PROD=false
|
PROD=false
|
||||||
SITE_NAME=
|
SITE_NAME=UGUU
|
||||||
SITE_URL=https://yoursite.com
|
SITE_URL=https://localhost
|
||||||
ABUSE_CONTACT=abuse@example.com
|
ABUSE_CONTACT=abuse@example.com
|
||||||
INFO_CONTACT=info@example.com
|
INFO_CONTACT=info@example.com
|
||||||
SERVER_CN_LOC=Sweden
|
SERVER_CN_LOC=Sweden
|
||||||
@ -20,4 +20,4 @@ ANTI_DUPE=false
|
|||||||
FILES_RETRIES=15
|
FILES_RETRIES=15
|
||||||
SSL=true
|
SSL=true
|
||||||
NAME_LENGTH=8
|
NAME_LENGTH=8
|
||||||
URL=
|
URL=https://filesdomain
|
||||||
|
@ -1,42 +1,67 @@
|
|||||||
FROM ubuntu:latest
|
FROM alpine:latest
|
||||||
|
|
||||||
ARG VERSION
|
ARG VERSION
|
||||||
|
|
||||||
RUN apt-get update && \
|
# Install the needed software
|
||||||
apt install -y software-properties-common && \
|
RUN apk add --no-cache curl nginx php8-fpm php8-sqlite3 php8-opcache sqlite nodejs git npm bash build-base supervisor
|
||||||
add-apt-repository ppa:ondrej/php && \
|
|
||||||
apt-get install -y build-essential nginx-full php8.0-fpm php8.0 sqlite3 php8.0-sqlite3 nodejs certbot git npm cron gettext-base && \
|
|
||||||
apt clean
|
|
||||||
|
|
||||||
|
# Create the www-data user and group
|
||||||
|
RUN set -x ; \
|
||||||
|
addgroup -g 82 -S www-data ; \
|
||||||
|
adduser -u 82 -D -S -G www-data www-data && exit 0 ; exit 1
|
||||||
|
|
||||||
|
# Link php bin
|
||||||
|
RUN ln -s /usr/bin/php8 /usr/bin/php
|
||||||
|
|
||||||
|
# Copy supervisor conf file
|
||||||
|
COPY docker/supervisord.conf /etc/supervisor/conf.d/supervisord.conf
|
||||||
|
|
||||||
|
# Set default workdir
|
||||||
WORKDIR /var/www/
|
WORKDIR /var/www/
|
||||||
|
|
||||||
COPY docker/docker-entrypoint.sh .
|
COPY docker/docker-entrypoint.sh .
|
||||||
|
|
||||||
ADD https://github.com/nokonoko/Uguu/archive/refs/tags/v${VERSION}.tar.gz v${VERSION}.tar.gz
|
# Download Uguu
|
||||||
|
ADD https://git.pomf.se/Pomf/uguu/archive/v${VERSION}.tar.gz v${VERSION}.tar.gz
|
||||||
RUN tar xvf v${VERSION}.tar.gz && \
|
RUN tar xvf v${VERSION}.tar.gz
|
||||||
mv Uguu-${VERSION}/ uguu
|
|
||||||
|
|
||||||
|
# Create the needed directories
|
||||||
RUN mkdir /var/www/uguu/dist && \
|
RUN mkdir /var/www/uguu/dist && \
|
||||||
mkdir /var/www/db && \
|
mkdir /var/www/db && \
|
||||||
mkdir /var/www/files
|
mkdir /var/www/files
|
||||||
|
|
||||||
|
# Create the Sqlite DB
|
||||||
RUN sqlite3 /var/www/db/uguu.sq3 -init /var/www/uguu/sqlite_schema.sql && \
|
RUN sqlite3 /var/www/db/uguu.sq3 -init /var/www/uguu/sqlite_schema.sql && \
|
||||||
chown -R www-data:www-data /var/www/db /var/www/files && \
|
chown -R www-data:www-data /var/www && \
|
||||||
chmod -R 775 /var/www/
|
chmod -R 775 /var/www/
|
||||||
|
|
||||||
|
# Fix script paths
|
||||||
RUN chmod a+x /var/www/uguu/checkdb.sh && \
|
RUN chmod a+x /var/www/uguu/checkdb.sh && \
|
||||||
chmod a+x /var/www/uguu/checkfiles.sh && \
|
chmod a+x /var/www/uguu/checkfiles.sh && \
|
||||||
sed -i 's#/path/to/files/#/var/www/uguu/files/#g' /var/www/uguu/checkfiles.sh && \
|
sed -i 's#/path/to/files/#/var/www/uguu/files/#g' /var/www/uguu/checkfiles.sh && \
|
||||||
sed -i 's#/path/to/db/uguu.sq3#/var/www/db/uguu.sq3#g' /var/www/uguu/checkdb.sh
|
sed -i 's#/path/to/db/uguu.sq3#/var/www/db/uguu.sq3#g' /var/www/uguu/checkdb.sh
|
||||||
|
|
||||||
RUN echo "0,30 * * * * bash /var/www/uguu/checkfiles.sh" >> /var/spool/cron/crontabs/root && \
|
# Add scripts to cron
|
||||||
echo "0,30 * * * * bash /var/www/uguu/checkdb.sh" >> /var/spool/cron/crontabs/root
|
RUN echo "0,30 * * * * bash /var/www/uguu/checkfiles.sh" >> /var/spool/cron/crontabs/www-data && \
|
||||||
|
echo "0,30 * * * * bash /var/www/uguu/checkdb.sh" >> /var/spool/cron/crontabs/www-data
|
||||||
COPY docker/uguu.conf /etc/nginx/conf.d/
|
|
||||||
|
|
||||||
COPY dist.json /var/www/uguu/_dist.json
|
|
||||||
|
|
||||||
|
# Copy Nginx Server conf
|
||||||
|
COPY docker/uguu.conf /etc/nginx/http.d/
|
||||||
|
|
||||||
|
# Copy SSL certs
|
||||||
|
COPY docker/ssl /etc/ssl
|
||||||
|
|
||||||
|
# Copy Uguu config
|
||||||
|
COPY dist.json /var/www/uguu/dist.json
|
||||||
|
|
||||||
|
# Give permissions to www-data
|
||||||
|
RUN chown -R www-data:www-data /run /var/lib/php8 /var/lib/nginx /var/log/nginx /var/log/php8 /etc/nginx /etc/php8
|
||||||
|
|
||||||
|
# Change user to www-data
|
||||||
|
USER www-data
|
||||||
|
|
||||||
|
# Expose port 80 from the container
|
||||||
EXPOSE 80
|
EXPOSE 80
|
||||||
|
|
||||||
|
# Load entrypoint
|
||||||
ENTRYPOINT [ "bash", "/var/www/docker-entrypoint.sh" ]
|
ENTRYPOINT [ "bash", "/var/www/docker-entrypoint.sh" ]
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
"allowErrors": false
|
"allowErrors": false
|
||||||
},
|
},
|
||||||
"dest": "dist",
|
"dest": "dist",
|
||||||
"pkgVersion": "1.5.2",
|
"pkgVersion": "1.5.3",
|
||||||
"banners": [
|
"banners": [
|
||||||
"banners/malware_scans.swig",
|
"banners/malware_scans.swig",
|
||||||
"banners/donations.swig"
|
"banners/donations.swig"
|
||||||
|
@ -1,8 +1,5 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
envsubst < /var/www/uguu/_dist.json > /var/www/uguu/dist.json
|
|
||||||
cd /var/www/uguu/
|
cd /var/www/uguu/
|
||||||
make
|
make
|
||||||
make install
|
make install
|
||||||
service php8.0-fpm start
|
/usr/bin/supervisord -c /etc/supervisor/conf.d/supervisord.conf
|
||||||
service cron start
|
|
||||||
nginx -g 'daemon off;'
|
|
||||||
|
0
docker/ssl/fullchain.pem
Normal file
0
docker/ssl/fullchain.pem
Normal file
0
docker/ssl/privkey.pem
Normal file
0
docker/ssl/privkey.pem
Normal file
32
docker/supervisord.conf
Normal file
32
docker/supervisord.conf
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
[supervisord]
|
||||||
|
nodaemon=true
|
||||||
|
logfile=/dev/null
|
||||||
|
logfile_maxbytes=0
|
||||||
|
pidfile=/run/supervisord.pid
|
||||||
|
|
||||||
|
[program:php-fpm]
|
||||||
|
command=php-fpm8 -F
|
||||||
|
stdout_logfile=/dev/stdout
|
||||||
|
stdout_logfile_maxbytes=0
|
||||||
|
stderr_logfile=/dev/stderr
|
||||||
|
stderr_logfile_maxbytes=0
|
||||||
|
autorestart=false
|
||||||
|
startretries=0
|
||||||
|
|
||||||
|
[program:nginx]
|
||||||
|
command=nginx -g 'daemon off;'
|
||||||
|
stdout_logfile=/dev/stdout
|
||||||
|
stdout_logfile_maxbytes=0
|
||||||
|
stderr_logfile=/dev/stderr
|
||||||
|
stderr_logfile_maxbytes=0
|
||||||
|
autorestart=false
|
||||||
|
startretries=0
|
||||||
|
|
||||||
|
[program:crond]
|
||||||
|
command=crond -b
|
||||||
|
stdout_logfile=/dev/stdout
|
||||||
|
stdout_logfile_maxbytes=0
|
||||||
|
stderr_logfile=/dev/stderr
|
||||||
|
stderr_logfile_maxbytes=0
|
||||||
|
autorestart=false
|
||||||
|
startretries=0
|
@ -1,13 +1,25 @@
|
|||||||
|
server {
|
||||||
|
listen 80;
|
||||||
|
server_name localhost;
|
||||||
|
return 301 https://localhost$request_uri;
|
||||||
|
}
|
||||||
|
|
||||||
|
server {
|
||||||
|
listen 80;
|
||||||
|
server_name filesdomain;
|
||||||
|
return 301 https://filesdomain$request_uri;
|
||||||
|
}
|
||||||
|
|
||||||
server{
|
server{
|
||||||
|
|
||||||
listen 80;
|
listen 443 ssl;
|
||||||
server_name localhost;
|
server_name localhost;
|
||||||
# ssl on;
|
ssl on;
|
||||||
# ssl_certificate /path/to/fullchain.pem;
|
ssl_certificate /etc/nginx/ssl/fullchain.pem;
|
||||||
# ssl_certificate_key /path/to/privkey.pem;
|
ssl_certificate_key /etc/nginx/ssl/privkey.pem;
|
||||||
# ssl_protocols TLSv1.2 TLSv1.3;
|
ssl_protocols TLSv1.2 TLSv1.3;
|
||||||
# ssl_ciphers 'EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH';
|
ssl_ciphers 'EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH';
|
||||||
# ssl_ecdh_curve secp384r1;
|
ssl_ecdh_curve secp384r1;
|
||||||
|
|
||||||
root /var/www/uguu/dist/;
|
root /var/www/uguu/dist/;
|
||||||
autoindex on;
|
autoindex on;
|
||||||
@ -18,15 +30,6 @@ server{
|
|||||||
expires 30d;
|
expires 30d;
|
||||||
}
|
}
|
||||||
|
|
||||||
location ^~ /files/ {
|
|
||||||
alias /var/www/files/;
|
|
||||||
index index.html index.htm;
|
|
||||||
autoindex off;
|
|
||||||
include mime.types;
|
|
||||||
types {
|
|
||||||
text/plain php;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
gzip on;
|
gzip on;
|
||||||
gzip_min_length 1000;
|
gzip_min_length 1000;
|
||||||
gzip_comp_level 6;
|
gzip_comp_level 6;
|
||||||
@ -41,4 +44,21 @@ server{
|
|||||||
include fastcgi_params;
|
include fastcgi_params;
|
||||||
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
server {
|
||||||
|
listen 443 ssl;
|
||||||
|
server_name filesdomain;
|
||||||
|
|
||||||
|
ssl on;
|
||||||
|
ssl_certificate /etc/nginx/ssl/fullchain.pem;
|
||||||
|
ssl_certificate_key /etc/nginx/ssl/privkey.pem;
|
||||||
|
ssl_protocols TLSv1.2 TLSv1.3;
|
||||||
|
ssl_ciphers 'EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH';
|
||||||
|
ssl_ecdh_curve secp384r1;
|
||||||
|
|
||||||
|
root /var/www/files/;
|
||||||
|
autoindex off;
|
||||||
|
access_log off;
|
||||||
|
index index.html;
|
||||||
|
}
|
||||||
|
8
docker_build.sh
Executable file
8
docker_build.sh
Executable file
@ -0,0 +1,8 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
echo ">>> BUILDING UGUU CONTAINER <<<"
|
||||||
|
make UGUU_RELEASE_VER=$(cat package.json | grep version | cut -d '"' -f4) DOCKER_TAG=$(cat package.json | grep version | cut -d '"' -f4) build-image
|
||||||
|
echo ">>> DONE! <<<"
|
||||||
|
|
||||||
|
echo ">>> Starting Uguu container! <<<"
|
||||||
|
make DOCKER_TAG=$(cat package.json | grep version | cut -d '"' -f4) CONTAINER_NAME=uguu run-container
|
||||||
|
echo ">>> DONE! <<<"
|
2
docker_purge.sh
Executable file
2
docker_purge.sh
Executable file
@ -0,0 +1,2 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
make DOCKER_TAG=$(cat package.json | grep version | cut -d '"' -f4) CONTAINER_NAME=uguu purge-container
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "uguu",
|
"name": "uguu",
|
||||||
"version": "1.5.2",
|
"version": "1.5.3",
|
||||||
"description": "Kawaii file host",
|
"description": "Kawaii file host",
|
||||||
"homepage": "https://uguu.se/",
|
"homepage": "https://uguu.se/",
|
||||||
"repository": {
|
"repository": {
|
||||||
@ -12,7 +12,7 @@
|
|||||||
"Pomf Community <github.com/pomf/pomf>",
|
"Pomf Community <github.com/pomf/pomf>",
|
||||||
"Uguu Community <github.com/nokonoko/uguu>"
|
"Uguu Community <github.com/nokonoko/uguu>"
|
||||||
],
|
],
|
||||||
"license": "MIT",
|
"license": "GPLV3",
|
||||||
"bugs": {
|
"bugs": {
|
||||||
"url": "https://github.com/nokonoko/uguu/issues"
|
"url": "https://github.com/nokonoko/uguu/issues"
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user