first commit

This commit is contained in:
Andy 2016-04-30 14:56:38 +02:00
parent 07775efe89
commit a1279be868
Signed by: arno
GPG Key ID: 368DDA2E9A471EAC
4 changed files with 97 additions and 0 deletions

30
Dockerfile Normal file
View File

@ -0,0 +1,30 @@
FROM ubuntu:xenial
MAINTAINER Andrey Arapov <andrey.arapov@nixaid.com>
RUN apt-get update && \
apt-get -y install python3 virtualenv mpv
# Workaround: pulseaudio client library likes to remove /dev/shm/pulse-shm-*
# files created by the host, causing sound to stop working.
# To fix this, we either want to disable the shm or mount /dev/shm
# in read-only mode when starting the container.
RUN echo "enable-shm = no" >> /etc/pulse/client.conf
ENV USER user
ENV UID 1000
ENV GROUPS audio
ENV HOME /home/$USER
RUN useradd -u $UID -m -d $HOME -s /usr/sbin/nologin -G $GROUPS $USER
USER $USER
WORKDIR $HOME
RUN virtualenv -p python3 venv && \
. venv/bin/activate && \
pip install --upgrade pip && \
pip install mps-youtube youtube-dl && \
deactivate &&\
mkdir $HOME/.config
VOLUME [ "/tmp", "$HOME/.config" ]
ENTRYPOINT [ "./venv/bin/mpsyt" ]

34
Dockerfile.alpineKO Normal file
View File

@ -0,0 +1,34 @@
# Problem: mpv neither mplayer compiled with the pulseaudio
#
FROM alpine:3.3
MAINTAINER Andrey Arapov <andrey.arapov@nixaid.com>
RUN echo '@testing http://dl-cdn.alpinelinux.org/alpine/edge/testing' >> /etc/apk/repositories && \
apk update && \
apk add python3 py-virtualenv ca-certificates mpv pulseaudio@testing
# Workaround: pulseaudio client library likes to remove /dev/shm/pulse-shm-*
# files created by the host, causing sound to stop working.
# To fix this, we either want to disable the shm or mount /dev/shm
# in read-only mode when starting the container.
RUN echo "enable-shm = no" >> /etc/pulse/client.conf
ENV USER user
ENV UID 1000
ENV GROUPS audio
ENV HOME /home/$USER
RUN adduser -D -h $HOME -s /bin/false -G $GROUPS -u $UID $USER
USER $USER
WORKDIR $HOME
RUN virtualenv -p python3 venv && \
. venv/bin/activate && \
pip install --upgrade pip && \
pip install mps-youtube youtube-dl && \
deactivate &&\
mkdir $HOME/.config
VOLUME [ "/tmp", "$HOME/.config" ]
ENTRYPOINT [ "./venv/bin/mpsyt" ]

22
README.md Normal file
View File

@ -0,0 +1,22 @@
# mps-youtube in Docker
Running [mps-youtube](https://github.com/mps-youtube/mps-youtube) in Docker
## Launching mps-youtube
### with Docker Compose
```
docker-compose run --rm mps-youtube
```
### with Docker
```
docker run --rm -ti \
--read-only=true \
-v $XDG_RUNTIME_DIR/pulse:/run/user/1000/pulse:ro \
-e PULSE_SERVER=unix:$XDG_RUNTIME_DIR/pulse/native \
andrey01/mps-youtube
```

11
docker-compose.yml Normal file
View File

@ -0,0 +1,11 @@
version: '2'
services:
mps-youtube:
image: andrey01/mps-youtube
read_only: true
network_mode: bridge
volumes:
- $XDG_RUNTIME_DIR/pulse:/run/user/1000/pulse:ro
environment:
- PULSE_SERVER=unix:$XDG_RUNTIME_DIR/pulse/native