├── README.md └── Dockerfile /README.md: -------------------------------------------------------------------------------- 1 | # Moonlight for Tizen - Dockerfile template 2 | An easy method for building Moonlight for Samsung TV 3 | 4 | ## Credits 5 | - Moonlight developers: https://moonlight-stream.org 6 | - Samsung developers: https://github.com/SamsungDForum/moonlight-chrome 7 | - This Dockerfile and support files have been adapted from [jellyfin-docker-tizen](https://github.com/babagreensheep/jellyfin-tizen-docker) 8 | - Dockerfile readapted for my repository tizen from [pablojrl123](https://github.com/pablojrl123/moonlight-tizen-docker) 9 | 10 | ## Usage 11 | 1. Enable developer mode on the TV (more information on [official Samsung guide](https://developer.samsung.com/smarttv/develop/getting-started/using-sdk/tv-device.html)): 12 | - Go to Apps. 13 | - Press `12345` on the remote; a dialog should pop up. 14 | - Set `Developer mode` to `On`; fill in the IP of the Docker host. 15 | - Power off and power on the TV as instructed; go once again to Apps. 16 | - Depending on your model, a "DEVELOP MODE" or similar message might appear. 17 | 18 | 2. Build the application within a Docker image: 19 | ``` 20 | docker build -t moonlight-tizen . 21 | ``` 22 | This will take a while. 23 | 24 | > Note: If you are running Docker on a Mac with a silicon chip (M1/M2 etc), change the first line in `Dockerfile` to 25 | > `FROM --platform=linux/amd64 ubuntu:22.04 as base` before building to ensure compability. 26 | 27 | 4. Deploy the application to the TV: 28 | - Run and enter a container; the container will be removed automatically on exit: 29 | ``` 30 | docker run -it --rm moonlight-tizen 31 | ``` 32 | - Connect to your TV over Smart Development Bridge: 33 | ```sh 34 | sdb connect YOUR_TV_IP 35 | ``` 36 | - Confirm that you are connected, take note of the device ID: 37 | ``` 38 | sdb devices 39 | ``` 40 | The device ID will be the last column, something like `UE65NU7400`. 41 | - Install the package: 42 | ```sh 43 | tizen install -n MoonlightWasm.wgt -t DEVICE_ID 44 | ``` 45 | Moonlight should now appear in your Recent Apps - or similar page - on your TV. 46 | - Exit the container: 47 | ```sh 48 | exit 49 | ``` 50 | - (Optional) Remove the Docker image: 51 | ```sh 52 | docker image rm moonlight-tizen 53 | ``` 54 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:22.04 as base 2 | 3 | ARG DEBIAN_FRONTEND=noninteractive 4 | ENV TZ=Etc/UTC 5 | RUN apt-get update && apt-get install -y \ 6 | cmake \ 7 | expect \ 8 | git \ 9 | ninja-build \ 10 | python2 \ 11 | unzip \ 12 | wget \ 13 | && rm -rf /var/lib/apt/lists/* 14 | 15 | # Some of Samsung scripts make reference to python, 16 | # but Ubuntu only provides /usr/bin/python2. 17 | RUN ln -sf /usr/bin/python2 /usr/bin/python 18 | 19 | # Use a non-root user from here on 20 | RUN useradd -m -s /bin/bash moonlight 21 | USER moonlight 22 | WORKDIR /home/moonlight 23 | 24 | # Install Tizen Studio 25 | # get file: web-cli_Tizen_Studio_5.0_ubuntu-64.bin 26 | RUN wget -nv -O web-cli_Tizen_Studio_5.0_ubuntu-64.bin 'https://download.tizen.org/sdk/Installer/tizen-studio_5.0/web-cli_Tizen_Studio_5.0_ubuntu-64.bin' 27 | RUN chmod a+x web-cli_Tizen_Studio_5.0_ubuntu-64.bin 28 | RUN ./web-cli_Tizen_Studio_5.0_ubuntu-64.bin --accept-license /home/moonlight/tizen-studio 29 | ENV PATH=/home/moonlight/tizen-studio/tools/ide/bin:/home/moonlight/tizen-studio/tools:${PATH} 30 | 31 | # Prepare Tizen signing cerficates 32 | RUN tizen certificate \ 33 | -a Moonlight \ 34 | -f Moonlight \ 35 | -p 1234 36 | RUN tizen security-profiles add \ 37 | -n Moonlight \ 38 | -a /home/moonlight/tizen-studio-data/keystore/author/Moonlight.p12 \ 39 | -p 1234 40 | 41 | # Workaround to package applications without gnome-keyring 42 | # These steps must be repeated each time prior to packaging an application. 43 | # See 44 | RUN sed -i 's|/home/moonlight/tizen-studio-data/keystore/author/Moonlight.pwd||' /home/moonlight/tizen-studio-data/profile/profiles.xml 45 | RUN sed -i 's|/home/moonlight/tizen-studio-data/tools/certificate-generator/certificates/distributor/tizen-distributor-signer.pwd|tizenpkcs12passfordsigner|' /home/moonlight/tizen-studio-data/profile/profiles.xml 46 | 47 | # Install Samsung Emscripten SDK 48 | # get file: emscripten-1.39.4.7-linux64.zip 49 | RUN wget -nv -O emscripten-1.39.4.7-linux64.zip 'https://developer.samsung.com/smarttv/file/a5013a65-af11-4b59-844f-2d34f14d19a9' 50 | RUN unzip emscripten-1.39.4.7-linux64.zip 51 | WORKDIR emscripten-release-bundle/emsdk 52 | RUN ./emsdk activate latest-fastcomp 53 | WORKDIR ../.. 54 | 55 | # Build moonlight 56 | RUN git clone --recurse-submodules --depth 1 https://github.com/KyroFrCode/moonlight-chrome-tizen 57 | 58 | RUN cmake \ 59 | -DCMAKE_TOOLCHAIN_FILE=/home/moonlight/emscripten-release-bundle/emsdk/fastcomp/emscripten/cmake/Modules/Platform/Emscripten.cmake \ 60 | -G Ninja \ 61 | -S moonlight-chrome-tizen \ 62 | -B build 63 | RUN cmake --build build 64 | RUN cmake --install build --prefix build 65 | 66 | RUN cp moonlight-chrome-tizen/icons/icon.png build/widget/ 67 | 68 | # Package and sign application 69 | # Effectively runs `tizen package -t wgt -- build/widget`, 70 | # but uses an expect cmdfile to automate the password prompt. 71 | RUN echo \ 72 | 'set timeout -1\n' \ 73 | 'spawn tizen package -t wgt -- build/widget\n' \ 74 | 'expect "Author password:"\n' \ 75 | 'send -- "1234\\r"\n' \ 76 | 'expect "Yes: (Y), No: (N) ?"\n' \ 77 | 'send -- "N\\r"\n' \ 78 | 'expect eof\n' \ 79 | | expect 80 | 81 | RUN mv build/widget/MoonlightWasm.wgt . 82 | 83 | # remove unneed files 84 | RUN rm -rf \ 85 | build \ 86 | emscripten-1.39.4.7-linux64.zip \ 87 | emscripten-release-bundle \ 88 | moonlight-chrome-tizen \ 89 | tizen-package-expect.sh \ 90 | web-cli_Tizen_Studio_5.0_ubuntu-64.bin \ 91 | .emscripten \ 92 | .emscripten_cache \ 93 | .emscripten_cache.lock \ 94 | .emscripten_ports \ 95 | .emscripten_sanity \ 96 | .package-manager \ 97 | .wget-hsts 98 | 99 | # Use a multistage build to reclaim space from deleted files 100 | FROM ubuntu:22.04 101 | COPY --from=base / / 102 | USER moonlight 103 | WORKDIR /home/moonlight 104 | 105 | # Add Tizen Studio to path 106 | ENV PATH=/home/moonlight/tizen-studio/tools/ide/bin:/home/moonlight/tizen-studio/tools:${PATH} 107 | 108 | # RUN sdb connect 192.168.0.228 109 | # RUN tizen install -n MoonlightWasm.wgt -t QN55Q65BAGC 110 | --------------------------------------------------------------------------------