Made flask_host configurable

This commit is contained in:
kvanzuijlen 2023-05-24 22:19:10 +00:00
parent 152170b53a
commit 56eef1bd6f
4 changed files with 37 additions and 6 deletions

View file

@ -9,17 +9,31 @@ FROM $BUILD_FROM
# 2 Modify Image #
##################
ARG CONFIG_PATH='/data/options.json'
# Add run.sh
COPY data/run.sh /
RUN chmod a+x /run.sh
# Set S6 wait time
ENV S6_CMD_WAIT_FOR_SERVICES=1 \
S6_CMD_WAIT_FOR_SERVICES_MAXTIME=0 \
S6_SERVICES_GRACETIME=0 \
FLASK_HOST=0.0.0.0 \
FLASK_PORT=4470
S6_SERVICES_GRACETIME=0
# FLASK_HOSTE=$(jq --raw-output '.flask_host // empty' $CONFIG_PATH)
RUN ln -s /root/.config /config
RUN apt-get update && apt-get install -y jq && rm -rf /var/lib/apt/lists/*
################
# 3 Entrypoint #
################
ENTRYPOINT ["sh"]
CMD ["/run.sh"]
############
# 5 Labels #
# 4 Labels #
############
ARG BUILD_ARCH
ARG BUILD_DATE

View file

@ -9,11 +9,15 @@ init: false
host_network: true
map:
- config:rw
options:
flask_host: "0.0.0.0"
schema:
flask_host: str
arch:
- aarch64
- amd64
- armv7
ports:
"4470": 4470
4470/tcp: 4470
ports_description:
"4470": "The webinterface for ankerctl"
4470/tcp: "The webinterface for ankerctl"

7
ankerctl/data/run.sh Normal file
View file

@ -0,0 +1,7 @@
#!/usr/bin/bash
CONFIG_PATH=/data/options.json
FLASK_HOST="$(jq --raw-output '.flask_host // empty' $CONFIG_PATH)"
/app/ankerctl.py webserver run --host="${FLASK_HOST}"

View file

@ -0,0 +1,6 @@
configuration:
flask_host:
name: "flask bind address"
description: "The address flask should bind to. NOTE: binding to 0.0.0.0 means everyone on your network can control your printer!"
network:
4470/TCP: The webserver port (Not used for Ingress)