From 0d376597d6ab99256e371673c006c9d77126b7d5 Mon Sep 17 00:00:00 2001 From: Elmar Kresse Date: Sun, 28 Dec 2025 15:50:59 +0100 Subject: [PATCH] add Dockerfile and docker-compose for multi-stage build; update .gitignore and various HTML examples --- .gitignore | 3 +- Dockerfile | 24 ++++++ docker-compose.yml | 20 +++++ examples/bayern.html | 3 +- examples/torfhaus.html | 19 +---- examples/wernigerode-pano.html | 2 +- examples/wetter-wernigerode.html | 2 +- go.mod | 6 +- pb_public/index.html | 2 +- pb_schema.json | 131 +++++++++++++++++++++++++++++++ 10 files changed, 189 insertions(+), 23 deletions(-) create mode 100644 Dockerfile create mode 100644 docker-compose.yml create mode 100644 pb_schema.json diff --git a/.gitignore b/.gitignore index 010db40..27ba254 100644 --- a/.gitignore +++ b/.gitignore @@ -5,4 +5,5 @@ *.mp4 *.png /pb_data/storage/ -/pb_data/storage/** \ No newline at end of file +/pb_data/storage/** +*.DS_Store \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..dd93371 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,24 @@ +# Multi-stage Dockerfile for Go (PocketBase) project +# --- Build Stage --- +FROM golang:1.21-alpine AS builder +WORKDIR /app +COPY go.mod . +COPY go.sum . +RUN go mod download +COPY . . +RUN CGO_ENABLED=0 GOOS=linux go build -o server main.go + +# --- Development Stage --- +FROM golang:1.21-alpine AS dev +WORKDIR /app +COPY --from=builder /app /app +EXPOSE 8080 +CMD ["go", "run", "main.go"] + +# --- Production Stage --- +FROM alpine:3.18 AS prod +WORKDIR /app +COPY --from=builder /app/server /app/server +COPY pb_public /app/pb_public +EXPOSE 8080 +CMD ["/app/server"] diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..d13091a --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,20 @@ +services: + app-prod: + build: + context: . + dockerfile: Dockerfile + target: prod + image: dbr-app:latest + ports: + - "8080:8080" + restart: unless-stopped + environment: + - POCKETBASE_HTTP_ADDR=0.0.0.0:8080 + volumes: + - ./pb_public:/app/pb_public:ro + - ./pb_data:/app/pb_data + command: ["/app/server", "serve", "--http=0.0.0.0:8080"] + +volumes: + pb_public: {} + pb_data: {} \ No newline at end of file diff --git a/examples/bayern.html b/examples/bayern.html index 014c9e5..8352faf 100644 --- a/examples/bayern.html +++ b/examples/bayern.html @@ -50,7 +50,8 @@ // Check if HLS.js is supported if (Hls.isSupported()) { const hls = new Hls(); - const proxyUrl = 'http://127.0.0.1:8090/cors?url=https://brevent.akamaized.net/hls/live/2028222/event_05/master1080p5000.m3u8'; + const localwindowurl = window.location.origin; + const proxyUrl = localwindowurl + '/cors?url=https://brevent.akamaized.net/hls/live/2028222/event_05/master1080p5000.m3u8'; hls.loadSource(proxyUrl); hls.attachMedia(videoPlayer); } else { diff --git a/examples/torfhaus.html b/examples/torfhaus.html index 51ebf76..9dfc387 100644 --- a/examples/torfhaus.html +++ b/examples/torfhaus.html @@ -35,25 +35,11 @@
-
- + \ No newline at end of file diff --git a/examples/wernigerode-pano.html b/examples/wernigerode-pano.html index 69d2c04..6abe48f 100644 --- a/examples/wernigerode-pano.html +++ b/examples/wernigerode-pano.html @@ -20,7 +20,7 @@ - +