Add maintained vectorcraft Helm chart
This commit is contained in:
commit
b4f111149b
11 files changed
+404
No files matched your search
@@ -0,0 +1,13 @@
|
||||
FROM docker.io/library/python:3.13-alpine AS fetch
|
||||
|
||||
ARG APP_NAME
|
||||
ARG APP_VERSION
|
||||
COPY download.py /usr/local/bin/download.py
|
||||
RUN APP_NAME="${APP_NAME}" APP_VERSION="${APP_VERSION}" python /usr/local/bin/download.py
|
||||
|
||||
FROM docker.io/library/nginx:1.30.6-alpine
|
||||
COPY nginx.conf /etc/nginx-artcraft.conf
|
||||
COPY --from=fetch /srv/web /srv/web
|
||||
USER 101:101
|
||||
EXPOSE 8080
|
||||
CMD ["nginx", "-g", "daemon off;", "-c", "/etc/nginx-artcraft.conf"]
|
||||
Executable
+34
@@ -0,0 +1,34 @@
|
||||
import os
|
||||
from pathlib import Path
|
||||
import shutil
|
||||
import tempfile
|
||||
import urllib.request
|
||||
import zipfile
|
||||
|
||||
name = os.environ["APP_NAME"]
|
||||
version = os.environ["APP_VERSION"]
|
||||
plain_version = version.removeprefix("v")
|
||||
url = f"https://github.com/storytold/{name}/releases/download/{version}/{name}-web-{plain_version}.zip"
|
||||
with tempfile.TemporaryDirectory() as tmp:
|
||||
archive = Path(tmp) / "release.zip"
|
||||
urllib.request.urlretrieve(url, archive)
|
||||
unpacked = Path(tmp) / "unpacked"
|
||||
with zipfile.ZipFile(archive) as bundle:
|
||||
for member in bundle.infolist():
|
||||
path = Path(member.filename)
|
||||
if path.is_absolute() or ".." in path.parts or (member.external_attr >> 16) & 0o170000 == 0o120000:
|
||||
raise ValueError(f"unsafe archive entry: {path}")
|
||||
bundle.extractall(unpacked)
|
||||
roots = [path.parent for path in unpacked.glob("*/index.html")]
|
||||
if (unpacked / "index.html").exists():
|
||||
roots = [unpacked]
|
||||
if len(roots) != 1:
|
||||
raise ValueError("expected exactly one web root")
|
||||
target = Path("/srv/web")
|
||||
target.mkdir(parents=True)
|
||||
for source in roots[0].iterdir():
|
||||
destination = target / source.name
|
||||
if source.is_dir():
|
||||
shutil.copytree(source, destination)
|
||||
else:
|
||||
shutil.copy2(source, destination)
|
||||
@@ -0,0 +1,28 @@
|
||||
worker_processes auto;
|
||||
pid /tmp/nginx.pid;
|
||||
error_log /dev/stderr warn;
|
||||
events { worker_connections 1024; }
|
||||
http {
|
||||
include /etc/nginx/mime.types;
|
||||
default_type application/octet-stream;
|
||||
access_log /dev/stdout;
|
||||
client_body_temp_path /tmp/client_temp;
|
||||
sendfile on;
|
||||
gzip on;
|
||||
gzip_types application/wasm application/javascript text/css application/json;
|
||||
server {
|
||||
listen 8080;
|
||||
root /srv/web;
|
||||
index index.html;
|
||||
add_header X-Content-Type-Options nosniff always;
|
||||
add_header Cache-Control no-cache always;
|
||||
location / { try_files $uri $uri/ =404; }
|
||||
location ~ /\. { deny all; }
|
||||
}
|
||||
server {
|
||||
listen 127.0.0.1:8081;
|
||||
access_log off;
|
||||
location = /nginx_status { stub_status; }
|
||||
location / { return 404; }
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user