add a gitignore, add some more important things to gitignore, make it so setup_venv.sh works on future Debian versions, add Dockerfile and lighttpd.conf file for running a news server in a container

This commit is contained in:
hankhill19580
2020-10-06 03:49:18 +00:00
parent 830200b232
commit 70e5ddc3f2
5 changed files with 75 additions and 1 deletions

6
.gitignore vendored Normal file
View File

@ -0,0 +1,6 @@
^build
^env
^etc/.*.custom
# Accidentally checking in a working transifexrc would be extremely bad!
.transifexrc
^logs

View File

@ -1,3 +1,6 @@
^build
^env
^etc/.*.custom
# Accidentally checking in a working transifexrc would be extremely bad!
.transifexrc
^logs

9
Dockerfile Normal file
View File

@ -0,0 +1,9 @@
FROM alpine
RUN apk update
RUN apk add lighttpd
COPY build /var/www/localhost/htdocs/news
COPY lighttpd.docker.conf /etc/lighttpd/lighttpd.conf
RUN mkdir -p /run/lighttpd/ && \
chown -R lighttpd /run/lighttpd
USER lighttpd
CMD lighttpd -f /etc/lighttpd/lighttpd.conf -D

52
lighttpd.docker.conf Normal file
View File

@ -0,0 +1,52 @@
var.basedir = "/var/www/localhost"
var.logdir = "/var/log/lighttpd"
var.statedir = "/var/lib/lighttpd"
server.port = 3000
server.modules = (
"mod_rewrite",
"mod_access",
"mod_accesslog"
)
#include "mime-types.conf"
mimetype.assign += ( ".su3" => "application/octet-stream",
".xml" => "text/xml",
".html" => "text/html",
".txt" => "text/plain", )
server.username = "lighttpd"
server.groupname = "lighttpd"
server.document-root = var.basedir + "/htdocs"
server.pid-file = "/run/lighttpd/lighttpd.pid"
server.errorlog = var.logdir + "/error.log"
server.indexfiles = ("index.php", "index.html",
"index.htm", "default.htm")
server.follow-symlink = "enable"
static-file.exclude-extensions = (".php", ".pl", ".cgi", ".fcgi")
accesslog.filename = var.logdir + "/access.log"
dir-listing.activate = "enable"
url.access-deny = ("~", ".inc")
url.rewrite-repeat = (
"^/news/news.atom.xml\?lang=([a-z]+(_[A-Za-z]+)?)" => "/news/news_$1.atom.xml",
"^/news/news.su3\?lang=([a-z]+(_[A-Za-z]+)?)" => "/news/news_$1.su3",
)
url.rewrite-repeat-if-not-file = (
"^/news/news_([a-z]+)_[A-Za-z]+.atom.xml" => "/news/news_$1.atom.xml",
"^/news/news_([a-z]+)_[A-Za-z]+.su3" => "/news/news_$1.su3",
"^/news/news_[a-z]+.atom.xml" => "/news/news.atom.xml",
"^/news/news_[a-z]+.su3" => "/news/news.su3",
)

View File

@ -7,8 +7,12 @@ if [ ! $venv ]; then
exit 1
else
if [ ! -d $venv_dir ] ; then
if $venv --version | grep '[2-9][0-9].0.*'; then
$venv $venv_dir
else
$venv --distribute $venv_dir
fi
fi
. $venv_dir/bin/activate
pip install -r etc/reqs.txt