Skip to content

Commit 432d2d9

Browse files
author
Christophe Boucharlat
committed
initial comit
0 parents  commit 432d2d9

File tree

6 files changed

+153
-0
lines changed

6 files changed

+153
-0
lines changed

Dockerfile

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Base docker image
2+
FROM debian:jessie
3+
LABEL maintainer "Christophe Boucharlat <christophe.boucharlat@gmail.com>"
4+
5+
# Discord Version 0.0.1
6+
7+
RUN apt-get update && apt-get install -y \
8+
apt-utils \
9+
dbus-x11 \
10+
dunst \
11+
hunspell-en-us \
12+
python3-dbus \
13+
software-properties-common \
14+
libx11-xcb1 \
15+
gconf2 \
16+
libgtk2.0-0 \
17+
libxtst6 \
18+
libnss3 \
19+
libasound2 \
20+
wget \
21+
--no-install-recommends && \
22+
apt-get clean && \
23+
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
24+
25+
RUN wget https://dl.discordapp.net/apps/linux/0.0.1/discord-0.0.1.tar.gz -O /tmp/discord.tar.gz && \
26+
cd /tmp/ && \
27+
tar xvzf /tmp/discord.tar.gz && \
28+
rm /etc/fonts/conf.d/10-scale-bitmap-fonts.conf && \
29+
fc-cache -fv
30+
31+
ENV QT_XKB_CONFIG_ROOT=/usr/share/X11/xkb
32+
33+
## Autorun Discord
34+
CMD ["/tmp/Discord/Discord"]

README.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# docker-discord
2+
A Docker image that start a fresh discord client.
3+
4+
[![Circle CI](https://circleci.com/gh/xorilog/docker-discord.svg?style=shield)](https://circleci.com/gh/xorilog/docker-discord)
5+
[![Image Layers](https://images.microbadger.com/badges/image/xorilog/discord.svg)](https://microbadger.com/images/xorilog/discord)
6+
7+
8+
## Usage
9+
To spawn a new instance of Discord:
10+
11+
```shell
12+
docker run --rm -it --name discord \
13+
-v /tmp/.X11-unix:/tmp/.X11-unix \
14+
-e DISPLAY=unix$DISPLAY \
15+
--device /dev/snd \
16+
-v /etc/localtime:/etc/localtime:ro \
17+
-v <Your_storage_dir>/.config/discord/:/root/.config/discord/ \
18+
xorilog/discord
19+
```
20+
## Issues
21+
* You have to log out Discord to close the docker container.
22+
23+
24+
## FAQ
25+
### Docker <1.8
26+
Before Docker 1.8 you need to replace `--device /dev/snd` by `-v /dev/snd:/dev/snd --privileged`.
27+
28+
29+
### QXcbConnection: Could not connect to display unix:0
30+
```shell
31+
xhost +
32+
```
33+
do not forget to remove it after start or usage (`xhost -`)
34+
The previous command is to be run on a linux machine. But Mac users, I have a special surprise for you. You can also do fun hacks with X11. Details are described [here](https://github.com/docker/docker/issues/8710).
35+
36+
37+
Thanks to [Discord](https://discordapp.com/) for their great app !

circle.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
machine:
2+
services:
3+
- docker
4+
5+
test:
6+
override:
7+
- tests/tests.sh

discord@.service

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
[Unit]
2+
Description=Discord with GUI in a container
3+
Requires=docker.service graphical.target
4+
After=docker.service
5+
Wants=display-manager.service NetworkManager-wait-online.service network-online.target
6+
7+
[Service]
8+
Environment="XAUTHORITY=/home/%i/.Xauthority"
9+
Environment=DISPLAY=:0
10+
User=%i
11+
ExecStartPre=-/usr/bin/docker pull xorilog/discord
12+
ExecStartPre=-/usr/bin/docker rm -vf discord
13+
ExecStartPre=/bin/bash -c "xhost +"
14+
ExecStart=/usr/bin/docker run -i --rm --name discord -v /etc/localtime:/etc/localtime:ro --ipc="host" -v /dev/shm:/dev/shm -v /tmp/.X11-unix:/tmp/.X11-unix -e DISPLAY=unix${DISPLAY} --device /dev/snd --device /dev/snd -v /home/%i/.config/discord:/root/.config/discord xorilog/discord
15+
ExecStop=/usr/bin/docker rm -vf discord
16+
ExecStop=/bin/bash -c "xhost -"
17+
Restart=on-failure
18+
19+
[Install]
20+
WantedBy=default.target

tests/tests.sh

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
#!/bin/bash
2+
set -e
3+
4+
# this is kind of an expensive check, so let's not do this twice if we
5+
# are running more than one validate bundlescript
6+
VALIDATE_REPO='https://github.com/xorilog/docker-discord.git'
7+
VALIDATE_BRANCH='master'
8+
9+
VALIDATE_HEAD="$(git rev-parse --verify HEAD)"
10+
11+
git fetch -q "$VALIDATE_REPO" "refs/heads/$VALIDATE_BRANCH"
12+
VALIDATE_UPSTREAM="$(git rev-parse --verify FETCH_HEAD)"
13+
14+
VALIDATE_COMMIT_DIFF="$VALIDATE_UPSTREAM...$VALIDATE_HEAD"
15+
16+
validate_diff() {
17+
if [ "$VALIDATE_UPSTREAM" != "$VALIDATE_HEAD" ]; then
18+
git diff "$VALIDATE_COMMIT_DIFF" "$@"
19+
else
20+
git diff HEAD~ "$@"
21+
fi
22+
}
23+
24+
base="xorilog/discord"
25+
suite="latest"
26+
build_dir="."
27+
28+
29+
# get the dockerfiles changed
30+
IFS=$'\n'
31+
files=( $(validate_diff --name-only -- '*Dockerfile') )
32+
unset IFS
33+
34+
(
35+
set -x
36+
docker build -t ${base}:${suite} ${build_dir}
37+
)
38+
39+
echo " --- "
40+
echo "Successfully built ${base}:${suite} with context ${build_dir}"
41+
echo " --- "

update.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/bin/bash
2+
3+
# Gather latest version of discord
4+
#version=$(curl --head https://tdesktop.com/linux/ |grep Location |cut -d '/' -f 5 |cut -d '.' -f 2-4)
5+
version=$(curl --head "https://discordapp.com/api/download?platform=linux&format=tar.gz" |grep Location |cut -d '/' -f 6)
6+
7+
### DISCORD ####
8+
### DISCORD ####
9+
10+
sed -i 's/Discord\ Version\ [0-9]*\.[0-9]*\.[0-9]*$/\Discord\ Version\ '$version'/' Dockerfile
11+
#sed -i 's/tsetup.*.tar.xz\ \-O/tsetup.'$version'.tar.xz\ \-O/' Dockerfile
12+
git commit -am "Discord version $version" -S
13+
git tag -am "Discord version $version" $version
14+
git push --follow-tags

0 commit comments

Comments
 (0)