forked from SamsungDForum/moonlight-chrome
-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathDockerfile
109 lines (93 loc) · 3.51 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
FROM ubuntu:22.04 as base
ARG DEBIAN_FRONTEND=noninteractive
ENV TZ=Etc/UTC
RUN apt-get update && apt-get install -y \
cmake \
expect \
git \
ninja-build \
python2 \
unzip \
wget \
&& rm -rf /var/lib/apt/lists/*
# Some of Samsung scripts make reference to python,
# but Ubuntu only provides /usr/bin/python2.
RUN ln -sf /usr/bin/python2 /usr/bin/python
# Use a non-root user from here on
RUN useradd -m -s /bin/bash moonlight
USER moonlight
WORKDIR /home/moonlight
# Install Tizen Studio
# get file: web-cli_Tizen_Studio_5.0_ubuntu-64.bin
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'
RUN chmod a+x web-cli_Tizen_Studio_5.0_ubuntu-64.bin
RUN ./web-cli_Tizen_Studio_5.0_ubuntu-64.bin --accept-license /home/moonlight/tizen-studio
ENV PATH=/home/moonlight/tizen-studio/tools/ide/bin:/home/moonlight/tizen-studio/tools:${PATH}
# Prepare Tizen signing cerficates
RUN tizen certificate \
-a Moonlight \
-f Moonlight \
-p 1234
RUN tizen security-profiles add \
-n Moonlight \
-a /home/moonlight/tizen-studio-data/keystore/author/Moonlight.p12 \
-p 1234
# Workaround to package applications without gnome-keyring
# These steps must be repeated each time prior to packaging an application.
# See <https://developer.tizen.org/forums/sdk-ide/pwd-fle-format-profile.xml-certificates>
RUN sed -i 's|/home/moonlight/tizen-studio-data/keystore/author/Moonlight.pwd||' /home/moonlight/tizen-studio-data/profile/profiles.xml
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
# Install Samsung Emscripten SDK
# get file: emscripten-1.39.4.7-linux64.zip
RUN wget -nv -O emscripten-1.39.4.7-linux64.zip 'https://developer.samsung.com/smarttv/file/a5013a65-af11-4b59-844f-2d34f14d19a9'
RUN unzip emscripten-1.39.4.7-linux64.zip
WORKDIR emscripten-release-bundle/emsdk
RUN ./emsdk activate latest-fastcomp
WORKDIR ../..
# Build moonlight
COPY --chown=moonlight . ./moonlight-chrome-tizen
RUN cmake \
-DCMAKE_TOOLCHAIN_FILE=/home/moonlight/emscripten-release-bundle/emsdk/fastcomp/emscripten/cmake/Modules/Platform/Emscripten.cmake \
-G Ninja \
-S moonlight-chrome-tizen \
-B build
RUN cmake --build build
RUN cmake --install build --prefix build
RUN cp moonlight-chrome-tizen/icons/icon.png build/widget/
# Package and sign application
# Effectively runs `tizen package -t wgt -- build/widget`,
# but uses an expect cmdfile to automate the password prompt.
RUN echo \
'set timeout -1\n' \
'spawn tizen package -t wgt -- build/widget\n' \
'expect "Author password:"\n' \
'send -- "1234\\r"\n' \
'expect "Yes: (Y), No: (N) ?"\n' \
'send -- "N\\r"\n' \
'expect eof\n' \
| expect
RUN mv build/widget/MoonlightWasm.wgt .
# remove unneed files
RUN rm -rf \
build \
emscripten-1.39.4.7-linux64.zip \
emscripten-release-bundle \
moonlight-chrome-tizen \
tizen-package-expect.sh \
web-cli_Tizen_Studio_5.0_ubuntu-64.bin \
.emscripten \
.emscripten_cache \
.emscripten_cache.lock \
.emscripten_ports \
.emscripten_sanity \
.package-manager \
.wget-hsts
# Use a multistage build to reclaim space from deleted files
FROM ubuntu:22.04
COPY --from=base / /
USER moonlight
WORKDIR /home/moonlight
# Add Tizen Studio to path
ENV PATH=/home/moonlight/tizen-studio/tools/ide/bin:/home/moonlight/tizen-studio/tools:${PATH}
# RUN sdb connect 192.168.0.228
# RUN tizen install -n MoonlightWasm.wgt -t QN55Q65BAGC