Deploy browser pre-alpha
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
FROM ubuntu:24.04 AS exporter
|
||||
|
||||
ARG GODOT_VERSION=4.6.2
|
||||
ARG GODOT_RELEASE=${GODOT_VERSION}-stable
|
||||
ARG GODOT_TEMPLATE_DIR=${GODOT_VERSION}.stable
|
||||
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y --no-install-recommends \
|
||||
ca-certificates curl unzip libasound2t64 libfontconfig1 libgl1 libx11-6 \
|
||||
libxcursor1 libxi6 libxinerama1 libxrandr2 \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
WORKDIR /opt/godot
|
||||
RUN curl -fsSLO "https://github.com/godotengine/godot-builds/releases/download/${GODOT_RELEASE}/Godot_v${GODOT_RELEASE}_linux.x86_64.zip" \
|
||||
&& curl -fsSLO "https://github.com/godotengine/godot-builds/releases/download/${GODOT_RELEASE}/Godot_v${GODOT_RELEASE}_export_templates.tpz" \
|
||||
&& curl -fsSLO "https://github.com/godotengine/godot-builds/releases/download/${GODOT_RELEASE}/SHA512-SUMS.txt" \
|
||||
&& grep "Godot_v${GODOT_RELEASE}_linux.x86_64.zip\|Godot_v${GODOT_RELEASE}_export_templates.tpz" SHA512-SUMS.txt > selected-checksums.txt \
|
||||
&& sha512sum --check selected-checksums.txt \
|
||||
&& unzip -q "Godot_v${GODOT_RELEASE}_linux.x86_64.zip" \
|
||||
&& install -m 0755 "Godot_v${GODOT_RELEASE}_linux.x86_64" /usr/local/bin/godot \
|
||||
&& mkdir -p "/root/.local/share/godot/export_templates/${GODOT_TEMPLATE_DIR}" /tmp/godot-templates \
|
||||
&& unzip -q "Godot_v${GODOT_RELEASE}_export_templates.tpz" -d /tmp/godot-templates \
|
||||
&& cp -a /tmp/godot-templates/templates/. "/root/.local/share/godot/export_templates/${GODOT_TEMPLATE_DIR}/"
|
||||
|
||||
WORKDIR /src
|
||||
COPY . .
|
||||
RUN mkdir -p /build \
|
||||
&& godot --headless --editor --path /src --quit \
|
||||
&& godot --headless --path /src --export-release Web /build/index.html \
|
||||
&& test -s /build/index.html \
|
||||
&& test -s /build/index.wasm \
|
||||
&& test -s /build/index.pck
|
||||
|
||||
FROM nginx:1.27-alpine
|
||||
COPY web/nginx.conf /etc/nginx/conf.d/default.conf
|
||||
COPY --from=exporter /build/ /usr/share/nginx/html/
|
||||
EXPOSE 8080
|
||||
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
|
||||
CMD wget -q -O /dev/null http://127.0.0.1:8080/healthz || exit 1
|
||||
@@ -0,0 +1,48 @@
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: step3-web
|
||||
labels:
|
||||
app: step3-web
|
||||
spec:
|
||||
replicas: 2
|
||||
strategy:
|
||||
type: RollingUpdate
|
||||
rollingUpdate:
|
||||
maxUnavailable: 0
|
||||
maxSurge: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app: step3-web
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: step3-web
|
||||
spec:
|
||||
containers:
|
||||
- name: web
|
||||
image: step3-web:latest
|
||||
imagePullPolicy: IfNotPresent
|
||||
ports:
|
||||
- containerPort: 8080
|
||||
resources:
|
||||
requests:
|
||||
cpu: 50m
|
||||
memory: 64Mi
|
||||
limits:
|
||||
cpu: 250m
|
||||
memory: 128Mi
|
||||
readinessProbe:
|
||||
httpGet:
|
||||
path: /healthz
|
||||
port: 8080
|
||||
initialDelaySeconds: 3
|
||||
periodSeconds: 10
|
||||
timeoutSeconds: 2
|
||||
livenessProbe:
|
||||
httpGet:
|
||||
path: /healthz
|
||||
port: 8080
|
||||
initialDelaySeconds: 10
|
||||
periodSeconds: 20
|
||||
timeoutSeconds: 2
|
||||
@@ -0,0 +1,5 @@
|
||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||
kind: Kustomization
|
||||
resources:
|
||||
- deployment.yaml
|
||||
- service.yaml
|
||||
@@ -0,0 +1,15 @@
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: step3-web
|
||||
labels:
|
||||
app: step3-web
|
||||
spec:
|
||||
selector:
|
||||
app: step3-web
|
||||
type: NodePort
|
||||
ports:
|
||||
- name: http
|
||||
port: 80
|
||||
targetPort: 8080
|
||||
nodePort: 30089
|
||||
@@ -0,0 +1,27 @@
|
||||
server {
|
||||
listen 8080;
|
||||
server_name _;
|
||||
root /usr/share/nginx/html;
|
||||
index index.html;
|
||||
gzip on;
|
||||
gzip_min_length 1024;
|
||||
gzip_types application/javascript application/wasm application/octet-stream text/css;
|
||||
|
||||
location = /healthz {
|
||||
access_log off;
|
||||
default_type text/plain;
|
||||
return 200 "ok\n";
|
||||
}
|
||||
|
||||
location = /index.html {
|
||||
add_header Cache-Control "no-cache, no-store, must-revalidate" always;
|
||||
add_header X-Content-Type-Options "nosniff" always;
|
||||
try_files $uri =404;
|
||||
}
|
||||
|
||||
location / {
|
||||
add_header Cache-Control "public, max-age=3600" always;
|
||||
add_header X-Content-Type-Options "nosniff" always;
|
||||
try_files $uri $uri/ /index.html;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user