fixes
This commit is contained in:
parent
4873a8aac1
commit
3b940afe60
6 changed files with 17 additions and 5 deletions
5
Makefile
5
Makefile
|
@ -15,6 +15,7 @@ FILESDOMAIN = $(shell $(CURDIR)/$(NODEJQ) -r ".FILE_DOMAIN" $(CURDIR)/$(CONF))
|
||||||
MAXSIZE = $(shell $(CURDIR)/$(NODEJQ) -r ".max_upload_size" $(CURDIR)/$(CONF))
|
MAXSIZE = $(shell $(CURDIR)/$(NODEJQ) -r ".max_upload_size" $(CURDIR)/$(CONF))
|
||||||
CONTACT_EMAIL = $(shell $(CURDIR)/$(NODEJQ) -r ".infoContact" $(CURDIR)/$(CONF))
|
CONTACT_EMAIL = $(shell $(CURDIR)/$(NODEJQ) -r ".infoContact" $(CURDIR)/$(CONF))
|
||||||
PKG_VERSION = $(shell $(CURDIR)/$(NODEJQ) -r ".version" $(CURDIR)/package.json)
|
PKG_VERSION = $(shell $(CURDIR)/$(NODEJQ) -r ".version" $(CURDIR)/package.json)
|
||||||
|
EXPIRE_TIME = $(shell $(CURDIR)/$(NODEJQ) -r ".expireTime" $(CURDIR)/package.json)
|
||||||
TMPDIR = $(shell mktemp -d)
|
TMPDIR = $(shell mktemp -d)
|
||||||
DOCKER_IMAGE = "$(shell basename $(CURDIR) | tr [:upper:] [:lower:])"
|
DOCKER_IMAGE = "$(shell basename $(CURDIR) | tr [:upper:] [:lower:])"
|
||||||
DOCKER_TAG = "$(DOCKER_TAG)"
|
DOCKER_TAG = "$(DOCKER_TAG)"
|
||||||
|
@ -90,12 +91,12 @@ npm_dependencies:
|
||||||
build-container-no-cache:
|
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
|
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/
|
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:
|
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
|
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/
|
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:
|
run-container:
|
||||||
docker run --name uguu -d -p 80:80 -p 443:443 uguu:$(PKG_VERSION)
|
docker run --name uguu -d -p 80:80 -p 443:443 uguu:$(PKG_VERSION)
|
||||||
|
|
|
@ -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
|
# Set ENV values for configuration
|
||||||
ARG DOMAIN
|
ARG DOMAIN
|
||||||
ENV DOMAIN=$DOMAIN
|
ENV DOMAIN=$DOMAIN
|
||||||
|
|
||||||
ARG FILE_DOMAIN
|
ARG FILE_DOMAIN
|
||||||
ENV FILE_DOMAIN=$FILE_DOMAIN
|
ENV FILE_DOMAIN=$FILE_DOMAIN
|
||||||
|
|
||||||
ARG CONTACT_EMAIL
|
ARG CONTACT_EMAIL
|
||||||
ENV CONTACT_EMAIL=$CONTACT_EMAIL
|
ENV CONTACT_EMAIL=$CONTACT_EMAIL
|
||||||
|
|
||||||
ARG MAX_SIZE
|
ARG MAX_SIZE
|
||||||
ENV MAX_SIZE=$MAX_SIZE
|
ENV MAX_SIZE=$MAX_SIZE
|
||||||
|
|
||||||
|
ARG EXPIRE_TIME
|
||||||
|
ENV EXPIRE_TIME=$EXPIRE_TIME
|
||||||
|
|
||||||
# Set default workdir
|
# Set default workdir
|
||||||
WORKDIR /var/www/
|
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/uguu.conf /etc/nginx/sites-enabled/uguu.conf
|
||||||
COPY docker/nginx/nginx.conf /etc/nginx/nginx.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
|
# Modify nginx values
|
||||||
RUN sed -i "s#XMAINDOMAINX#${DOMAIN}#g" /etc/nginx/sites-enabled/uguu.conf
|
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
|
RUN sed -i "s#XFILESDOMAINX#${FILE_DOMAIN}#g" /etc/nginx/sites-enabled/uguu.conf
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
"tools.ejs"
|
"tools.ejs"
|
||||||
],
|
],
|
||||||
"max_upload_size": 128,
|
"max_upload_size": 128,
|
||||||
"expireTime": "48H",
|
"expireTime": "48",
|
||||||
"siteName": "Uguu",
|
"siteName": "Uguu",
|
||||||
"subTitle": "wahooo",
|
"subTitle": "wahooo",
|
||||||
"DOMAIN": "domain.com",
|
"DOMAIN": "domain.com",
|
||||||
|
|
|
@ -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'));"
|
|
@ -1,2 +1,3 @@
|
||||||
#! /bin/sh
|
#! /bin/sh
|
||||||
|
hours=$((XXX*60))
|
||||||
find /path/to/files/ -mmin +1440 -exec rm -f {} \;
|
find /path/to/files/ -mmin +1440 -exec rm -f {} \;
|
|
@ -1,6 +1,6 @@
|
||||||
<h1><%= siteName %>~</h1>
|
<h1><%= siteName %>~</h1>
|
||||||
<p class="lead">
|
<p class="lead">
|
||||||
Max upload size is <%= max_upload_size %> MiB & files expire after <%= expireTime %>, read the
|
Max upload size is <%= max_upload_size %> MiB & files expire after <%= expireTime %>H, read the
|
||||||
<a href="faq.html">
|
<a href="faq.html">
|
||||||
<abbr title="Frequently asked questions">FAQ</abbr>
|
<abbr title="Frequently asked questions">FAQ</abbr>
|
||||||
</a>
|
</a>
|
||||||
|
|
Loading…
Reference in a new issue