use pip for python dependencies
This commit is contained in:
		
							
								
								
									
										30
									
								
								Dockerfile
									
									
									
									
									
								
							
							
						
						
									
										30
									
								
								Dockerfile
									
									
									
									
									
								
							@@ -1,20 +1,30 @@
 | 
			
		||||
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 ["mkdir", "/app"]
 | 
			
		||||
COPY ["stream.py", "/app/stream.py"]
 | 
			
		||||
COPY ["sources.py", "/app/sources.py"]
 | 
			
		||||
RUN ["apk", "add", "--no-cache", "py3-virtualenv"]
 | 
			
		||||
RUN ["mkdir", "-p", "/app"]
 | 
			
		||||
COPY ["tv.json", "/app/setup/tv.json"]
 | 
			
		||||
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/script.js", "/app/script.js"]
 | 
			
		||||
COPY ["frontend/style.css", "/app/style.css"]
 | 
			
		||||
RUN ["chmod", "-R", "755", "/app"]
 | 
			
		||||
COPY ["tv.json", "/app/tv.json"]
 | 
			
		||||
RUN ["python3", "/app/sources.py"]
 | 
			
		||||
RUN ["rm", "/app/tv.json"]
 | 
			
		||||
RUN ["rm", "/app/sources.py"]
 | 
			
		||||
 | 
			
		||||
FROM base as sources
 | 
			
		||||
RUN ["apk", "add", "--no-cache", "py3-requests"]
 | 
			
		||||
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
 | 
			
		||||
COPY --from=base / /
 | 
			
		||||
COPY --from=sources / /
 | 
			
		||||
COPY --from=venv /app/venv /app/venv
 | 
			
		||||
USER 1444:1444
 | 
			
		||||
ENV ICECAST_SERVER=https://icecast.purser.it:7000
 | 
			
		||||
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
 | 
			
		||||
 | 
			
		||||
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())
 | 
			
		||||
        for name in tv:
 | 
			
		||||
            playlist[name] = tv[name]
 | 
			
		||||
 | 
			
		||||
    with open("/app/sources.json", "w+") as f:
 | 
			
		||||
        f.write(json.dumps(playlist))
 | 
			
		||||
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
 | 
			
		||||
		Reference in New Issue
	
	Block a user