1
0
mirror of https://github.com/nokonoko/Uguu.git synced 2024-01-06 13:35:15 +00:00
This commit is contained in:
Go Johansson (neku) 2023-01-01 12:53:42 +01:00
parent 4873a8aac1
commit 3b940afe60
6 changed files with 17 additions and 5 deletions

View File

@ -15,6 +15,7 @@ FILESDOMAIN = $(shell $(CURDIR)/$(NODEJQ) -r ".FILE_DOMAIN" $(CURDIR)/$(CONF))
MAXSIZE = $(shell $(CURDIR)/$(NODEJQ) -r ".max_upload_size" $(CURDIR)/$(CONF))
CONTACT_EMAIL = $(shell $(CURDIR)/$(NODEJQ) -r ".infoContact" $(CURDIR)/$(CONF))
PKG_VERSION = $(shell $(CURDIR)/$(NODEJQ) -r ".version" $(CURDIR)/package.json)
EXPIRE_TIME = $(shell $(CURDIR)/$(NODEJQ) -r ".expireTime" $(CURDIR)/package.json)
TMPDIR = $(shell mktemp -d)
DOCKER_IMAGE = "$(shell basename $(CURDIR) | tr [:upper:] [:lower:])"
DOCKER_TAG = "$(DOCKER_TAG)"
@ -90,12 +91,12 @@ npm_dependencies:
build-container-no-cache:
tar --exclude='uguuForDocker.tar.gz' --exclude='vendor' --exclude='node_modules' --exclude='build' --exclude='dist' --exclude='.git' -czf uguuForDocker.tar.gz src docker Makefile package.json package-lock.json
mv uguuForDocker.tar.gz docker/
docker build -f docker/Dockerfile --build-arg VERSION=$(PKG_VERSION) --no-cache -t uguu:$(PKG_VERSION) .
docker build -f docker/Dockerfile --build-arg DOMAIN=$(SITEDOMAIN) --build-arg FILE_DOMAIN=$(FILESDOMAIN) --build-arg CONTACT_EMAIL=$(FILESDOMAIN) --build-arg MAX_SIZE=$(MAXSIZE) --build-arg MAX_SIZE=$(EXPIRE_TIME) --no-cache -t uguu:$(PKG_VERSION) .
build-container:
tar --exclude='uguuForDocker.tar.gz' --exclude='vendor' --exclude='node_modules' --exclude='build' --exclude='dist' --exclude='.git' -czf uguuForDocker.tar.gz src docker Makefile package.json package-lock.json
mv uguuForDocker.tar.gz docker/
docker build -f docker/Dockerfile --build-arg DOMAIN=$(SITEDOMAIN) --build-arg FILE_DOMAIN=$(FILESDOMAIN) --build-arg CONTACT_EMAIL=$(FILESDOMAIN) --build-arg MAX_SIZE=$(MAXSIZE) -t uguu:$(PKG_VERSION) .
docker build -f docker/Dockerfile --build-arg DOMAIN=$(SITEDOMAIN) --build-arg FILE_DOMAIN=$(FILESDOMAIN) --build-arg CONTACT_EMAIL=$(FILESDOMAIN) --build-arg MAX_SIZE=$(MAXSIZE) --build-arg MAX_SIZE=$(EXPIRE_TIME) -t uguu:$(PKG_VERSION) .
run-container:
docker run --name uguu -d -p 80:80 -p 443:443 uguu:$(PKG_VERSION)

View File

@ -19,13 +19,19 @@ RUN apt-get install -y build-essential nginx-full php8.1-fpm php8.1 sqlite3 php8
# Set ENV values for configuration
ARG DOMAIN
ENV DOMAIN=$DOMAIN
ARG FILE_DOMAIN
ENV FILE_DOMAIN=$FILE_DOMAIN
ARG CONTACT_EMAIL
ENV CONTACT_EMAIL=$CONTACT_EMAIL
ARG MAX_SIZE
ENV MAX_SIZE=$MAX_SIZE
ARG EXPIRE_TIME
ENV EXPIRE_TIME=$EXPIRE_TIME
# Set default workdir
WORKDIR /var/www/
@ -59,6 +65,10 @@ RUN chmod a+x /var/www/uguu/src/static/scripts/checkdb.sh && \
COPY docker/nginx/uguu.conf /etc/nginx/sites-enabled/uguu.conf
COPY docker/nginx/nginx.conf /etc/nginx/nginx.conf
# Modify expire time
RUN sed -i "s#XXX#${EXPIRE_TIME}#g" /var/www/uguu/src/static/scripts/checkfiles.sh
RUN sed -i "s#XXX#${EXPIRE_TIME}#g" /var/www/uguu/src/static/scripts/checkdb.sh
# Modify nginx values
RUN sed -i "s#XMAINDOMAINX#${DOMAIN}#g" /etc/nginx/sites-enabled/uguu.conf
RUN sed -i "s#XFILESDOMAINX#${FILE_DOMAIN}#g" /etc/nginx/sites-enabled/uguu.conf

View File

@ -10,7 +10,7 @@
"tools.ejs"
],
"max_upload_size": 128,
"expireTime": "48H",
"expireTime": "48",
"siteName": "Uguu",
"subTitle": "wahooo",
"DOMAIN": "domain.com",

View File

@ -1 +1 @@
sqlite3 /path/to/db/uguu.sq3 "DELETE FROM files WHERE date <= strftime('%s', datetime('now', '-1 day'));"
sqlite3 /path/to/db/uguu.sq3 "DELETE FROM files WHERE date <= strftime('%s', datetime('now', '-XXX hours'));"

View File

@ -1,2 +1,3 @@
#! /bin/sh
hours=$((XXX*60))
find /path/to/files/ -mmin +1440 -exec rm -f {} \;

View File

@ -1,6 +1,6 @@
<h1><%= siteName %>~</h1>
<p class="lead">
Max upload size is <%= max_upload_size %>&nbsp;MiB & files expire after <%= expireTime %>, read the
Max upload size is <%= max_upload_size %>&nbsp;MiB & files expire after <%= expireTime %>H, read the
<a href="faq.html">
<abbr title="Frequently asked questions">FAQ</abbr>
</a>