diff --git a/.gitea/workflows/build.yml b/.gitea/workflows/build.yml new file mode 100644 index 0000000..5fa3417 --- /dev/null +++ b/.gitea/workflows/build.yml @@ -0,0 +1,42 @@ +name: Build Docker +run-name: Build Docker Images +on: + push: + +jobs: + Build Image: + runs-on: [ubuntu-latest, arm] + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Install Docker + run : | + apt-get install ca-certificates curl gnupg + install -m 0755 -d /etc/apt/keyrings + curl -fsSL https://download.docker.com/linux/debian/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg + chmod a+r /etc/apt/keyrings/docker.gpg + echo "deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/debian "$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null + apt-get update + apt-get install docker-ce-cli -y + - name: Build Docker image + run : | + cd master + echo "${{ secrets.DOCKERGIT_TOKEN }}" | docker login git.woodburn.au -u nathanwoodburn --password-stdin + echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" + tag=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}} + tag=${tag//\//-} + tag_num=${GITHUB_RUN_NUMBER} + echo "tag_num=$tag_num" + + if [[ "$tag" == "main" ]]; then + tag="latest" + else + tag_num="${tag}-${tag_num}" + fi + + + docker build -t nic:$tag_num . + docker tag nic:$tag_num git.woodburn.au/nathanwoodburn/nic:$tag_num + docker push git.woodburn.au/nathanwoodburn/nic:$tag_num + docker tag nic:$tag_num git.woodburn.au/nathanwoodburn/nic:$tag + docker push git.woodburn.au/nathanwoodburn/nic:$tag \ No newline at end of file diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..5a4a2b9 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,2 @@ +flask +python-dotenv \ No newline at end of file diff --git a/server.py b/server.py new file mode 100644 index 0000000..07c6c1b --- /dev/null +++ b/server.py @@ -0,0 +1,21 @@ +from flask import Flask, make_response, redirect, request, jsonify, render_template, send_from_directory +import os +import dotenv + +app = Flask(__name__) +dotenv.load_dotenv() + +@app.route('/assets/') +def send_report(path): + return send_from_directory('templates/assets', path) + + +@app.route('/') +def index(): + # Get host from request + host = request.headers.get('host') + + return render_template('index.html', tld=host) + +if __name__ == '__main__': + app.run(debug=False, port=5000, host='0.0.0.0') \ No newline at end of file diff --git a/404.html b/templates/404.html similarity index 100% rename from 404.html rename to templates/404.html diff --git a/assets/bootstrap/css/bootstrap.min.css b/templates/assets/bootstrap/css/bootstrap.min.css similarity index 100% rename from assets/bootstrap/css/bootstrap.min.css rename to templates/assets/bootstrap/css/bootstrap.min.css diff --git a/assets/bootstrap/js/bootstrap.min.js b/templates/assets/bootstrap/js/bootstrap.min.js similarity index 100% rename from assets/bootstrap/js/bootstrap.min.js rename to templates/assets/bootstrap/js/bootstrap.min.js diff --git a/assets/css/404.css b/templates/assets/css/404.css similarity index 100% rename from assets/css/404.css rename to templates/assets/css/404.css diff --git a/templates/assets/css/index.css b/templates/assets/css/index.css new file mode 100644 index 0000000..5f32372 --- /dev/null +++ b/templates/assets/css/index.css @@ -0,0 +1,11 @@ +html { + height: 100%; +} +footer { + position: absolute; + bottom: 0; + width: 100%; + height: 60px; + line-height: 60px; + padding-left: 5%; +} \ No newline at end of file diff --git a/assets/img/background.jpg b/templates/assets/img/background.jpg similarity index 100% rename from assets/img/background.jpg rename to templates/assets/img/background.jpg diff --git a/assets/img/favicon.png b/templates/assets/img/favicon.png similarity index 100% rename from assets/img/favicon.png rename to templates/assets/img/favicon.png diff --git a/assets/js/404.js b/templates/assets/js/404.js similarity index 100% rename from assets/js/404.js rename to templates/assets/js/404.js diff --git a/index.html b/templates/index.html similarity index 64% rename from index.html rename to templates/index.html index 23c3e33..85db1bf 100644 --- a/index.html +++ b/templates/index.html @@ -4,7 +4,7 @@ - .tas/ domains + .{{tld}}/ domains @@ -12,15 +12,16 @@ +