diff --git a/Dockerfile-local b/Dockerfile-local new file mode 100644 index 000000000..73dfb505e --- /dev/null +++ b/Dockerfile-local @@ -0,0 +1,37 @@ +FROM node:25 AS node + +WORKDIR /app +COPY web web + +## remove generated files in case the developer build with npm before +RUN rm -rf web/assets/ts-dist &&\ + rm -rf web/assets/css-dist + +WORKDIR /app/web +RUN npm i --no-dev + +FROM golang:1.26 AS build-env + +RUN mkdir /gostuff +WORKDIR /gostuff +COPY go.mod go.sum ./ + +# Get dependencies - will also be cached if we won't change mod/sum +RUN go mod download + +WORKDIR /go/src/app +COPY . . +COPY --from=node /app/web/assets ./web/assets +COPY --from=node /app/web/node_modules ./web/node_modules + +# bundle version into binary if specified in build-args, dev otherwise. +ARG version=dev +RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags "-w -extldflags '-static' -X main.VersionTag=${version}" -o /go/bin/tumlive cmd/tumlive/main.go + +FROM alpine:3.23 +RUN apk add --no-cache tzdata openssl +WORKDIR /app +COPY --from=build-env /go/bin/tumlive . +COPY config.yaml /etc/TUM-Live/config.yaml +RUN sed -i 's|ingestbase: rtmp://ingest.tum.live/|ingestbase: rtmp://ingest/|' /etc/TUM-Live/config.yaml +CMD ["sh", "-c", "sleep 3 && ./tumlive"] diff --git a/docker-compose-selfstream.yml b/docker-compose-selfstream.yml new file mode 100644 index 000000000..44f564ba1 --- /dev/null +++ b/docker-compose-selfstream.yml @@ -0,0 +1,157 @@ +#################################################### +# Not production ready, only for local development # +#################################################### + +services: + tum-live: + container_name: tum-live + depends_on: + db: + condition: service_started + meili-internal: + condition: service_healthy + build: + context: . + dockerfile: Dockerfile-local + volumes: + - ./config.yaml:/etc/TUM-Live/config.yaml + - ./branding/branding.yaml:/etc/TUM-Live/branding.yaml + - mass:/mass + restart: always + environment: + - DBHOST=db + - TZ=Europe/Berlin + ports: + - "8081:8081" + extra_hosts: # Only needed if you use wsl + - "localhost:host-gateway" + healthcheck: + test: [ "CMD-SHELL", "nc -z localhost 8081 || exit 1" ] + interval: 5s + timeout: 3s + retries: 15 + start_period: 60s # Gibt dem Dienst Zeit zum Booten + runner: + container_name: tum-live-runner + depends_on: + tum-live: + condition: service_healthy + #- vod-service # Omitted for local development due to size. Comment out to use voice-service + build: + context: runner/ + dockerfile: Dockerfile + platform: linux/amd64 + environment: + - STORAGE_PATH=/storage/mass + - SEGMENT_PATH=/storage/live + - REALHOST=runner + - "EDGE_SERVER=http://localhost:8089" + - "GOCAST_SERVER=tum-live:50056" + volumes: + - runner_data:/storage/live + - vod:/storage/mass + ports: + - "52735:52735" + extra_hosts: # Only needed if you use wsl + - "ingest.tum.live:host-gateway" + ingest: + container_name: tum-live-ingest + #- vod-service # Omitted for local development due to size. Comment out to use voice-service + build: + context: ingest/ + dockerfile: Dockerfile-local + platform: linux/amd64 + ports: + - "1935:1935" + edge: + container_name: tum-live-edge + depends_on: + tum-live: + condition: service_healthy + build: worker/edge + environment: + - VOD_DIR=/vod + - MAIN_INSTANCE=http://tum-live:8081 + - ADMIN_TOKEN=123 + ports: + - "8089:8089" + volumes: + - vod:/vod + db: + container_name: mariadb_container + image: mariadb + environment: + MYSQL_ROOT_USER: root + MYSQL_ROOT_PASSWORD: example + TZ: Europe/Berlin + command: --init-file /data/application/init.sql + volumes: + - ./tum-live-starter.sql:/data/application/init.sql + - mariadb-data:/var/lib/mysql + restart: always + worker: + container_name: tum-live-worker + depends_on: + runner: + condition: service_started + #- vod-service # Omitted for local development due to size. Comment out to use voice-service + build: worker + platform: linux/amd64 + environment: + - Token=abc + - Host=worker + - MainBase=tum-live + - VodURLTemplate=http://localhost:8089/vod/%s.mp4/playlist.m3u8 + - LrzUploadUrl=http://vod-service:8080 + - DEBUG-MODE=true + volumes: + - recordings:/recordings + - mass:/mass + vod-service: + container_name: tum-live-vod-service + depends_on: + runner: + condition: service_started + build: + context: vod-service + dockerfile: Dockerfile-local + environment: + - OUTPUT_DIR=/vod + volumes: + - vod:/vod + meili-internal: # Service-Name geƤndert + image: getmeili/meilisearch:latest + # KEIN container_name! (Docker generiert einen eindeutigen Namen) + ports: + - "7700:7700" # Extern 7701 nutzen, um Konflikt mit 7700 zu vermeiden + environment: + - MEILI_HTTP_ADDR=0.0.0.0:7700 + - MEILI_MASTER_KEY=MASTER_KEY + - MEILI_NO_ANALYTICS=true + volumes: + - meili_gocast_data:/meili_data # Eigener Volume-Name + healthcheck: + test: [ "CMD-SHELL", "wget -q --spider http://127.0.0.1:7700/health || exit 1" ] + interval: 5s + timeout: 3s + retries: 10 + start_period: 20s +# Omitted for local development due to size. Comment out to use voice-service +# voice-service: +# container_name: tum-live-voice-service +# image: ghcr.io/tum-dev/tum-live-voice-service:latest +# environment: +# - TRANSCRIBER=whisper +# - WHISPER_MODEL=tiny +# - MAX_WORKERS=10 +# - DEBUG=1 +# volumes: +# - mass:/mass + +volumes: + vod: + mariadb-data: + runner_data: + mass: + meili_gocast_data: + recordings: \ No newline at end of file diff --git a/ingest/Dockerfile-local b/ingest/Dockerfile-local new file mode 100644 index 000000000..358ac4965 --- /dev/null +++ b/ingest/Dockerfile-local @@ -0,0 +1,16 @@ +FROM bluenviron/mediamtx:1.17.1 as mediamtx + +FROM alpine:3.23 +ADD entrypoint.sh /entrypoint.sh +ADD mediamtx.yml /mediamtx.yml +RUN chmod +x /entrypoint.sh +RUN sed -i 's|externalAuthenticationURL: https://tum.live/api/selfstream/onPublish|externalAuthenticationURL: http://tum-live:8081/api/selfstream/onPublish|' /mediamtx.yml + +RUN apk add --no-cache \ + ffmpeg \ + tzdata + +COPY --from=mediamtx /mediamtx /mediamtx +RUN chmod +x /mediamtx + +CMD ["/entrypoint.sh"] diff --git a/vod-service/Dockerfile-local b/vod-service/Dockerfile-local new file mode 100644 index 000000000..5c62b3c39 --- /dev/null +++ b/vod-service/Dockerfile-local @@ -0,0 +1,15 @@ +FROM golang:1.26 as builder + +WORKDIR /app +COPY . . + +RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o /vod-service cmd/vod-service/main.go + +FROM alpine:3.23 + +RUN apk add ffmpeg +COPY --from=builder /vod-service /vod-service + +EXPOSE 8080 + +CMD ["/vod-service"] \ No newline at end of file