perlweb/static-misc: Another container to run non-pm.org static perl stuff

This commit is contained in:
Ask Bjørn Hansen 2017-09-23 01:44:27 -07:00
commit 7991b9e866
4 changed files with 96 additions and 0 deletions

13
Dockerfile Normal file
View File

@ -0,0 +1,13 @@
FROM quay.io/ntppool/base-os:v2.3
USER root
WORKDIR /web
VOLUME /git
VOLUME /web/config
RUN apk update; apk add apache2
RUN mkdir /run/apache2; chown apache /run/apache2
RUN ln -s /dev/stderr /var/log/apache2/error.log
RUN ln -s /dev/stdout /var/log/apache2/access.log
RUN echo "IncludeOptional /web/config/*.conf" >> /etc/apache2/httpd.conf
ADD run-httpd /run.sh
CMD /run.sh

32
README.md Normal file
View File

@ -0,0 +1,32 @@
# static-misc
## Test locally
docker build -t quay.io/perl/static-web:v0.1 .
git clone git@git.develooper.com:perl-static-misc.git git
docker run -p 8000:80 -n static-misc \
-v `pwd`/git:/git/static -v `pwd`/config:/web/config \
-ti --rm quay.io/perl/static-web:v0.1
Test with
curl -H 'Host: i.perl.org' localhost:8000
To get a shell in the container run
docker exec -ti static-misc bash
And then run `curl -H 'Host: i.perl.org' localhost` there.
## Production image
The "production image" is in https://quay.io/perl/static-web - the image
is "manually" built and pushed because I didn't want to give quay access
to all of this git repository.
REV=v1.0
IMAGE=quay.io/perl/static-web:$REV
docker build -t $IMAGE . && \
docker push $IMAGE

39
ingress.tmpl Normal file
View File

@ -0,0 +1,39 @@
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: static-misc
annotations:
kubernetes.io/tls-acme: "true"
kubernetes.io/ingress.class: nginx
{{- \$js := (json "ingress-hosts.json") }}
{{- \$hosts := (\$js | pointer "/Hosts") }}
{{- \$tls := (\$js | pointer "/tls") }}
spec:
rules:
{{block "hosts" \$hosts}}{{ range . }}
- host: {{ . }}
http:
paths:
- path: /
backend:
serviceName: static-misc
servicePort: 80
{{end}}
{{end}}
{{ if \$tls }}
{{- range \$g, \$h := \$tls }}
{{ template "hosts" \$h }}
{{- end }}
tls:
{{ range \$g, \$h := \$tls }}
- hosts:
{{ range \$h -}}
- {{ . }}
{{ end -}}
secretName: {{ \$g }}-tls
{{ end }}
{{ end }}

12
run-httpd Executable file
View File

@ -0,0 +1,12 @@
#!/bin/sh
set -ex
if [ ! -z "$READY_FILE" ]; then
while [ ! -e $READY_FILE ]; do
echo waiting for $READY_FILE
sleep 10
done
fi
exec httpd -DFOREGROUND -e info
#exec httpd -DFOREGROUND -e debug