rebuild mediamtx for proper integration with rclone, need to add sh later for debug

This commit is contained in:
tdv
2025-10-28 19:27:40 +02:00
parent ad0fe7b09a
commit e92194f739
3 changed files with 35 additions and 21 deletions

View File

@@ -91,9 +91,10 @@ services:
- proxy
mediamtx:
image: bluenviron/mediamtx:latest
# restart: unless-stopped
# Expose default listeners for all common protocols
build:
context: ./mediamtx
dockerfile: Dockerfile
restart: unless-stopped
ports:
- "8554:8554" # RTSP
- "1935:1935" # RTMP
@@ -105,13 +106,6 @@ services:
volumes:
- ./mediamtx/mediamtx.yml:/mediamtx.yml:ro,Z
- mediamtx-recordings:/recordings
networks:
- proxy
- snoopBack
rclone:
image: rclone/rclone:latest
command: rcd --rc-addr=:5572 --rc-no-auth
environment:
RCLONE_CONFIG_MINIO_TYPE: s3
RCLONE_CONFIG_MINIO_PROVIDER: Minio
@@ -120,11 +114,10 @@ services:
RCLONE_CONFIG_MINIO_SECRET_ACCESS_KEY: minioadmin
RCLONE_CONFIG_MINIO_REGION: us-east-1
RCLONE_CONFIG_MINIO_FORCE_PATH_STYLE: "true"
volumes:
- mediamtx-recordings:/recordings
networks:
- snoopBack
- proxy
- snoopBack
# NEW: EMQX MQTT broker
emqx:

19
mediamtx/Dockerfile Normal file
View File

@@ -0,0 +1,19 @@
# ---- Stage 1: Build rclone ----
FROM alpine:3.20 AS rclone-builder
RUN apk add --no-cache curl unzip && \
curl -fsSL https://downloads.rclone.org/rclone-current-linux-amd64.zip -o /tmp/rclone.zip && \
unzip /tmp/rclone.zip -d /tmp && \
mv /tmp/rclone-*/rclone /usr/local/bin/rclone && \
chmod +x /usr/local/bin/rclone
# ---- Stage 2: Final image ----
FROM bluenviron/mediamtx:latest
# Copy only the rclone binary from the builder
COPY --from=rclone-builder /usr/local/bin/rclone /usr/local/bin/rclone
# Optional: verify installation (uncomment if debugging)
RUN ["/usr/local/bin/rclone", "version"]
ENTRYPOINT ["/mediamtx"]

View File

@@ -59,14 +59,16 @@ pathDefaults:
# \"dstFs\":\"minio:livestream\",
# \"dstRemote\":\"$MTX_PATH/$f\"}"'
runOnRecordSegmentCreate: >
sh -c 'd="$(dirname "$MTX_SEGMENT_PATH")";
f="$(basename "$MTX_SEGMENT_PATH")";
curl -s -H "Content-Type: application/json"
-X POST "http://rclone:5572/operations/copyfile?_async=true"
-d "{\"srcFs\":\"$d\",\"srcRemote\":\"$f\",
\"dstFs\":\"minio:livestream\",
\"dstRemote\":\"$MTX_PATH/$f\"}"'
# runOnRecordSegmentCreate: >
# sh -c 'd="$(dirname "$MTX_SEGMENT_PATH")";
# f="$(basename "$MTX_SEGMENT_PATH")";
# curl -s -H "Content-Type: application/json"
# -X POST "http://rclone:5572/operations/copyfile?_async=true"
# -d "{\"srcFs\":\"$d\",\"srcRemote\":\"$f\",
# \"dstFs\":\"minio:livestream\",
# \"dstRemote\":\"$MTX_PATH/$f\"}"'
runOnRecordSegmentCreate: rclone copy "$MTX_SEGMENT_PATH" "minio:livestream/${MTX_SEGMENT_PATH#/recordings/whip/live/}" --progress
authInternalUsers:
- user: any