use pip for python dependencies
This commit is contained in:
parent
4504dc7c6d
commit
5dd5390fac
30
Dockerfile
30
Dockerfile
@ -1,20 +1,30 @@
|
|||||||
FROM alpine:edge as base
|
FROM alpine:edge as base
|
||||||
RUN ["apk", "add", "--no-cache", "--repository", "https://dl-cdn.alpinelinux.org/alpine/edge/testing", "streamlink", "py3-tornado", "py3-aiohttp", "py3-aiohttp-socks"]
|
RUN ["apk", "add", "--no-cache", "py3-virtualenv"]
|
||||||
RUN ["mkdir", "/app"]
|
RUN ["mkdir", "-p", "/app"]
|
||||||
COPY ["stream.py", "/app/stream.py"]
|
COPY ["tv.json", "/app/setup/tv.json"]
|
||||||
COPY ["sources.py", "/app/sources.py"]
|
COPY ["backend/start.sh", "/app/start.sh"]
|
||||||
|
COPY ["backend/install.sh", "/app/setup/install.sh"]
|
||||||
|
COPY ["backend/sources.py", "/app/setup/sources.py"]
|
||||||
|
COPY ["backend/stream.py", "/app/stream.py"]
|
||||||
COPY ["frontend/index.html", "/app/index.html"]
|
COPY ["frontend/index.html", "/app/index.html"]
|
||||||
COPY ["frontend/script.js", "/app/script.js"]
|
COPY ["frontend/script.js", "/app/script.js"]
|
||||||
COPY ["frontend/style.css", "/app/style.css"]
|
COPY ["frontend/style.css", "/app/style.css"]
|
||||||
RUN ["chmod", "-R", "755", "/app"]
|
RUN ["chmod", "-R", "755", "/app"]
|
||||||
COPY ["tv.json", "/app/tv.json"]
|
|
||||||
RUN ["python3", "/app/sources.py"]
|
FROM base as sources
|
||||||
RUN ["rm", "/app/tv.json"]
|
RUN ["apk", "add", "--no-cache", "py3-requests"]
|
||||||
RUN ["rm", "/app/sources.py"]
|
RUN ["python3", "/app/setup/sources.py"]
|
||||||
|
RUN ["rm", "-r", "/app/setup"]
|
||||||
|
|
||||||
|
FROM base as venv
|
||||||
|
RUN ["apk", "add", "--no-cache", "musl-dev", "build-base", "python3-dev"]
|
||||||
|
RUN ["/app/setup/install.sh"]
|
||||||
|
RUN ["rm", "-r", "/app/setup"]
|
||||||
|
|
||||||
FROM scratch
|
FROM scratch
|
||||||
COPY --from=base / /
|
COPY --from=sources / /
|
||||||
|
COPY --from=venv /app/venv /app/venv
|
||||||
USER 1444:1444
|
USER 1444:1444
|
||||||
ENV ICECAST_SERVER=https://icecast.purser.it:7000
|
ENV ICECAST_SERVER=https://icecast.purser.it:7000
|
||||||
ENV STREAM_SERVER=https://stream.purser.it
|
ENV STREAM_SERVER=https://stream.purser.it
|
||||||
ENTRYPOINT ["/app/stream.py"]
|
ENTRYPOINT ["/app/start.sh"]
|
||||||
|
5
backend/install.sh
Normal file
5
backend/install.sh
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
#!/usr/bin/env sh
|
||||||
|
virtualenv --python=$(which python3) /app/venv
|
||||||
|
source /app/venv/bin/activate
|
||||||
|
pip install --upgrade pip
|
||||||
|
pip install --upgrade streamlink tornado aiohttp aiohttp-socks
|
@ -25,11 +25,10 @@ else:
|
|||||||
playlist[mount_name] = value
|
playlist[mount_name] = value
|
||||||
|
|
||||||
if playlist is not None:
|
if playlist is not None:
|
||||||
with open("/app/tv.json", "r") as f:
|
with open("/app/setup/tv.json", "r") as f:
|
||||||
tv = json.loads(f.read())
|
tv = json.loads(f.read())
|
||||||
for name in tv:
|
for name in tv:
|
||||||
playlist[name] = tv[name]
|
playlist[name] = tv[name]
|
||||||
|
|
||||||
with open("/app/sources.json", "w+") as f:
|
with open("/app/sources.json", "w+") as f:
|
||||||
f.write(json.dumps(playlist))
|
f.write(json.dumps(playlist))
|
||||||
try:
|
try:
|
3
backend/start.sh
Normal file
3
backend/start.sh
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
#!/usr/bin/env sh
|
||||||
|
source /app/venv/bin/activate
|
||||||
|
exec /app/stream.py
|
Loading…
Reference in New Issue
Block a user