templating - prepare integration into ui
This commit is contained in:
parent
c7b81cfc10
commit
99c259bf18
|
@ -1,6 +1,6 @@
|
|||
{% if USE_REVERSE_PROXY == "yes" %}
|
||||
{% for k, v in all.items() %}
|
||||
{% if k.startswith("REVERSE_PROXY_URL") %}
|
||||
{% if k.startswith("REVERSE_PROXY_URL") and v != "" %}
|
||||
{% set url = v %}
|
||||
{% set host = all[k.replace("URL", "HOST")] if k.replace("URL", "HOST") in all else "" %}
|
||||
{% set ws = all[k.replace("URL", "WS")] if k.replace("URL", "WS") in all else "" %}
|
||||
|
|
|
@ -24,7 +24,7 @@ class Configurator :
|
|||
if self.__check_var(var, value) :
|
||||
self.__variables[var] = value
|
||||
else :
|
||||
print("Problem with " + var + "=" + value)
|
||||
print("Ignoring " + var + "=" + value)
|
||||
|
||||
def get_config(self) :
|
||||
config = {}
|
||||
|
|
|
@ -9,7 +9,7 @@ class Templator :
|
|||
self.__target_path = target_path
|
||||
if not self.__target_path.endswith("/") :
|
||||
self.__target_path += "/"
|
||||
self.__template_env = jinja2.Environment(loader=jinja2.FileSystemLoader(searchpath=self.__input_path))
|
||||
self.__template_env = jinja2.Environment(loader=jinja2.FileSystemLoader(searchpath=self.__input_path), trim_blocks=True, lstrip_blocks=True)
|
||||
|
||||
def render_global(self) :
|
||||
return self.__render("global")
|
||||
|
|
|
@ -1,23 +1,28 @@
|
|||
FROM nginx:1.20.1-alpine AS builder
|
||||
|
||||
FROM alpine
|
||||
|
||||
RUN apk add py3-pip apache2-utils bash && \
|
||||
pip3 install docker flask && \
|
||||
mkdir /opt/entrypoint && \
|
||||
mkdir -p /opt/confs/site && \
|
||||
addgroup -g 101 nginx && \
|
||||
adduser -h /var/cache/nginx -g nginx -s /sbin/nologin -G nginx -D -H -u 101 nginx && \
|
||||
mkdir /etc/nginx && \
|
||||
chown root:nginx /etc/nginx && \
|
||||
chmod 770 /etc/nginx
|
||||
|
||||
COPY --from=builder /etc/nginx/ /opt/confs/nginx
|
||||
|
||||
COPY ui/dependencies.sh /tmp
|
||||
RUN chmod +x /tmp/dependencies.sh && \
|
||||
/tmp/dependencies.sh && \
|
||||
rm -f /tmp/dependencies.sh
|
||||
|
||||
COPY gen/ /opt/gen
|
||||
#COPY entrypoint/ /opt/entrypoint
|
||||
#COPY confs/global/ /opt/confs/global
|
||||
COPY confs/site/ /opt/confs/site
|
||||
COPY entrypoint/* /opt/entrypoint/
|
||||
COPY ui/ /opt/entrypoint/
|
||||
RUN chmod +x /opt/entrypoint/*.py /opt/entrypoint/*.sh
|
||||
COPY ui/* /opt/entrypoint/
|
||||
COPY settings.json /opt
|
||||
|
||||
COPY ui/prepare.sh /tmp
|
||||
chmod +x /tmp/prepare && \
|
||||
/tmp/prepare.sh && \
|
||||
rm -f /tmp/prepare.sh
|
||||
|
||||
EXPOSE 5000
|
||||
|
||||
WORKDIR /opt/entrypoint
|
||||
ENV FLASK_APP entrypoint.py
|
||||
ENTRYPOINT ["/usr/bin/python3", "-m", "flask", "run", "--host=0.0.0.0"]
|
||||
ENTRYPOINT ["/usr/bin/python3", "-m", "flask", "run", "--host=0.0.0.0"]
|
|
@ -1,19 +1,28 @@
|
|||
FROM nginx:1.20.1-alpine AS builder
|
||||
|
||||
FROM amd64/alpine
|
||||
|
||||
RUN apk add py3-pip apache2-utils bash && \
|
||||
pip3 install docker flask && \
|
||||
mkdir /opt/entrypoint && \
|
||||
mkdir -p /opt/confs/site
|
||||
COPY --from=builder /etc/nginx/ /opt/confs/nginx
|
||||
|
||||
COPY ui/dependencies.sh /tmp
|
||||
RUN chmod +x /tmp/dependencies.sh && \
|
||||
/tmp/dependencies.sh && \
|
||||
rm -f /tmp/dependencies.sh
|
||||
|
||||
COPY gen/ /opt/gen
|
||||
#COPY entrypoint/ /opt/entrypoint
|
||||
#COPY confs/global/ /opt/confs/global
|
||||
COPY confs/site/ /opt/confs/site
|
||||
COPY entrypoint/* /opt/entrypoint/
|
||||
COPY ui/ /opt/entrypoint/
|
||||
RUN chmod +x /opt/entrypoint/*.py /opt/entrypoint/*.sh
|
||||
COPY ui/* /opt/entrypoint/
|
||||
COPY settings.json /opt
|
||||
|
||||
VOLUME /etc/nginx
|
||||
COPY ui/prepare.sh /tmp
|
||||
chmod +x /tmp/prepare && \
|
||||
/tmp/prepare.sh && \
|
||||
rm -f /tmp/prepare.sh
|
||||
|
||||
EXPOSE 5000
|
||||
|
||||
WORKDIR /opt/entrypoint
|
||||
ENV FLASK_APP entrypoint.py
|
||||
ENTRYPOINT ["/usr/bin/python3", "-m", "flask", "run", "--host=0.0.0.0"]
|
||||
ENTRYPOINT ["/usr/bin/python3", "-m", "flask", "run", "--host=0.0.0.0"]
|
|
@ -1,26 +1,34 @@
|
|||
FROM alpine AS builder
|
||||
FROM alpine AS builder1
|
||||
|
||||
ENV QEMU_URL https://github.com/balena-io/qemu/releases/download/v4.0.0%2Bbalena2/qemu-4.0.0.balena2-arm.tar.gz
|
||||
RUN apk add curl && curl -L ${QEMU_URL} | tar zxvf - -C . --strip-components 1
|
||||
|
||||
FROM nginx:1.20.1-alpine AS builder2
|
||||
|
||||
FROM arm32v7/alpine
|
||||
|
||||
COPY --from=builder qemu-arm-static /usr/bin
|
||||
COPY --from=builder1 qemu-arm-static /usr/bin
|
||||
COPY --from=builder2 /etc/nginx/ /opt/confs/nginx
|
||||
|
||||
RUN apk add py3-pip apache2-utils bash && \
|
||||
pip3 install docker flask && \
|
||||
mkdir /opt/entrypoint && \
|
||||
mkdir -p /opt/confs/site
|
||||
COPY ui/dependencies.sh /tmp
|
||||
RUN chmod +x /tmp/dependencies.sh && \
|
||||
/tmp/dependencies.sh && \
|
||||
rm -f /tmp/dependencies.sh
|
||||
|
||||
COPY gen/ /opt/gen
|
||||
#COPY entrypoint/ /opt/entrypoint
|
||||
#COPY confs/global/ /opt/confs/global
|
||||
COPY confs/site/ /opt/confs/site
|
||||
COPY entrypoint/* /opt/entrypoint/
|
||||
COPY ui/ /opt/entrypoint/
|
||||
RUN chmod +x /opt/entrypoint/*.py /opt/entrypoint/*.sh
|
||||
COPY ui/* /opt/entrypoint/
|
||||
COPY settings.json /opt
|
||||
|
||||
VOLUME /etc/nginx
|
||||
COPY ui/prepare.sh /tmp
|
||||
chmod +x /tmp/prepare && \
|
||||
/tmp/prepare.sh && \
|
||||
rm -f /tmp/prepare.sh
|
||||
|
||||
EXPOSE 5000
|
||||
|
||||
WORKDIR /opt/entrypoint
|
||||
ENV FLASK_APP entrypoint.py
|
||||
ENTRYPOINT ["/usr/bin/python3", "-m", "flask", "run", "--host=0.0.0.0"]
|
||||
ENTRYPOINT ["/usr/bin/python3", "-m", "flask", "run", "--host=0.0.0.0"]
|
|
@ -1,26 +1,34 @@
|
|||
FROM alpine AS builder
|
||||
FROM alpine AS builder1
|
||||
|
||||
ENV QEMU_URL https://github.com/balena-io/qemu/releases/download/v4.0.0%2Bbalena2/qemu-4.0.0.balena2-aarch64.tar.gz
|
||||
RUN apk add curl && curl -L ${QEMU_URL} | tar zxvf - -C . --strip-components 1
|
||||
|
||||
FROM nginx:1.20.1-alpine AS builder2
|
||||
|
||||
FROM arm64v8/alpine
|
||||
|
||||
COPY --from=builder qemu-aarch64-static /usr/bin
|
||||
COPY --from=builder1 qemu-aarch64-static /usr/bin
|
||||
COPY --from=builder2 /etc/nginx/ /opt/confs/nginx
|
||||
|
||||
RUN apk add py3-pip apache2-utils bash && \
|
||||
pip3 install docker flask && \
|
||||
mkdir /opt/entrypoint && \
|
||||
mkdir -p /opt/confs/site
|
||||
COPY ui/dependencies.sh /tmp
|
||||
RUN chmod +x /tmp/dependencies.sh && \
|
||||
/tmp/dependencies.sh && \
|
||||
rm -f /tmp/dependencies.sh
|
||||
|
||||
COPY gen/ /opt/gen
|
||||
#COPY entrypoint/ /opt/entrypoint
|
||||
#COPY confs/global/ /opt/confs/global
|
||||
COPY confs/site/ /opt/confs/site
|
||||
COPY entrypoint/* /opt/entrypoint/
|
||||
COPY ui/ /opt/entrypoint/
|
||||
RUN chmod +x /opt/entrypoint/*.py /opt/entrypoint/*.sh
|
||||
COPY ui/* /opt/entrypoint/
|
||||
COPY settings.json /opt
|
||||
|
||||
VOLUME /etc/nginx
|
||||
COPY ui/prepare.sh /tmp
|
||||
chmod +x /tmp/prepare && \
|
||||
/tmp/prepare.sh && \
|
||||
rm -f /tmp/prepare.sh
|
||||
|
||||
EXPOSE 5000
|
||||
|
||||
WORKDIR /opt/entrypoint
|
||||
ENV FLASK_APP entrypoint.py
|
||||
ENTRYPOINT ["/usr/bin/python3", "-m", "flask", "run", "--host=0.0.0.0"]
|
||||
ENTRYPOINT ["/usr/bin/python3", "-m", "flask", "run", "--host=0.0.0.0"]
|
|
@ -1,19 +1,28 @@
|
|||
FROM nginx:1.20.1-alpine AS builder
|
||||
|
||||
FROM i386/alpine
|
||||
|
||||
RUN apk add py3-pip apache2-utils bash && \
|
||||
pip3 install docker flask && \
|
||||
mkdir /opt/entrypoint && \
|
||||
mkdir -p /opt/confs/site
|
||||
COPY --from=builder /etc/nginx/ /opt/confs/nginx
|
||||
|
||||
COPY ui/dependencies.sh /tmp
|
||||
RUN chmod +x /tmp/dependencies.sh && \
|
||||
/tmp/dependencies.sh && \
|
||||
rm -f /tmp/dependencies.sh
|
||||
|
||||
COPY gen/ /opt/gen
|
||||
#COPY entrypoint/ /opt/entrypoint
|
||||
#COPY confs/global/ /opt/confs/global
|
||||
COPY confs/site/ /opt/confs/site
|
||||
COPY entrypoint/* /opt/entrypoint/
|
||||
COPY ui/ /opt/entrypoint/
|
||||
RUN chmod +x /opt/entrypoint/*.py /opt/entrypoint/*.sh
|
||||
COPY ui/* /opt/entrypoint/
|
||||
COPY settings.json /opt
|
||||
|
||||
VOLUME /etc/nginx
|
||||
COPY ui/prepare.sh /tmp
|
||||
chmod +x /tmp/prepare && \
|
||||
/tmp/prepare.sh && \
|
||||
rm -f /tmp/prepare.sh
|
||||
|
||||
EXPOSE 5000
|
||||
|
||||
WORKDIR /opt/entrypoint
|
||||
ENV FLASK_APP entrypoint.py
|
||||
ENTRYPOINT ["/usr/bin/python3", "-m", "flask", "run", "--host=0.0.0.0"]
|
||||
ENTRYPOINT ["/usr/bin/python3", "-m", "flask", "run", "--host=0.0.0.0"]
|
|
@ -0,0 +1,4 @@
|
|||
#!/bin/sh
|
||||
|
||||
apk add py3-pip bash
|
||||
pip3 install docker flask
|
|
@ -0,0 +1,14 @@
|
|||
#!/bin/sh
|
||||
|
||||
# create nginx user
|
||||
addgroup -g 101 nginx
|
||||
adduser -h /var/cache/nginx -g nginx -s /bin/sh -G nginx -D -H -u 101 nginx
|
||||
|
||||
# prepare /opt
|
||||
chown -R root:nginx /opt
|
||||
find /opt -type f -exec chmod 0740 {} \;
|
||||
find /opt -type d -exec chmod 0750 {} \;
|
||||
chmod ugo+x /opt/entrypoint/*
|
||||
chmod ugo+x /opt/gen/main.py
|
||||
chmod 770 /opt
|
||||
chmod 440 /opt/settings.json
|
Loading…
Reference in New Issue