diff options
author | Jinwei Zhao <[email protected]> | 2016-11-15 20:07:09 +0800 |
---|---|---|
committer | Jinwei Zhao <[email protected]> | 2016-11-15 20:07:09 +0800 |
commit | 0ec16411337e958e024a40cd2fa79ba028770708 (patch) | |
tree | 89debc5bb5f89288decff0174ddc80a4691d9700 /Dockerfile | |
parent | 60778bceb264f833acfe2484eae6555f1040b23b (diff) | |
download | LumberJack-0ec16411337e958e024a40cd2fa79ba028770708.tar.gz |
how to access host's screenshot inside a container?
Diffstat (limited to 'Dockerfile')
-rw-r--r-- | Dockerfile | 27 |
1 files changed, 17 insertions, 10 deletions
@@ -1,26 +1,33 @@ | |||
1 | # LumberJack bot | ||
2 | # It is difficult to dockerize this bot | ||
3 | # I have no idea how to access host's screenshot | ||
4 | # inside a docker container | ||
5 | # Project's present status: | ||
6 | # It can access mouse move inside a container | ||
7 | # But due to it cannot access screenshot of the host | ||
8 | # it cannot make decisions yet | ||
9 | |||
1 | FROM ubuntu:latest | 10 | FROM ubuntu:latest |
2 | MAINTAINER clarkzjw <[email protected]> | 11 | MAINTAINER clarkzjw <[email protected]> |
3 | 12 | ||
4 | # Install Ubuntu and base software. | ||
5 | RUN \ | 13 | RUN \ |
6 | sed -i 's/# \(.*multiverse$\)/\1/g' /etc/apt/sources.list && \ | 14 | sed -i 's/# \(.*multiverse$\)/\1/g' /etc/apt/sources.list && \ |
7 | apt-get update && \ | 15 | apt-get update && \ |
8 | apt-get -y upgrade && \ | 16 | apt-get -y upgrade && \ |
9 | apt-get install -y firefox sudo xvfb scrot git build-essential python3 python3-dev python3-pip python3-tk && \ | 17 | apt-get install -y firefox sudo xvfb scrot git build-essential python3 python3-dev python3-pip python3-tk |
10 | rm -rf /var/lib/apt/lists/* | ||
11 | 18 | ||
12 | RUN export uid=1000 gid=1000 && \ | 19 | RUN export uid=1000 gid=1000 && \ |
13 | mkdir -p /home/developer && \ | 20 | mkdir -p /home/developer && \ |
14 | echo "developer:x:${uid}:${gid}:Developer,,,:/home/developer:/bin/bash" >> /etc/passwd && \ | 21 | echo "developer:x:${uid}:${gid}:Developer,,,:/home/developer:/bin/bash" >> /etc/passwd && \ |
15 | echo "developer:x:${uid}:" >> /etc/group && \ | 22 | echo "developer:x:${uid}:" >> /etc/group && \ |
16 | echo "developer ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/developer && \ | 23 | echo "developer ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/developer && \ |
17 | chmod 0440 /etc/sudoers.d/developer && \ | 24 | chmod 0440 /etc/sudoers.d/developer && \ |
18 | chown ${uid}:${gid} -R /home/developer | 25 | chown ${uid}:${gid} -R /home/developer |
19 | 26 | ||
20 | RUN \ | 27 | RUN \ |
21 | Xvfb :1 -screen 0 1366x768x16 &> xvfb.log && \ | 28 | Xvfb :1 -screen 0 1366x768x16 &> xvfb.log && \ |
22 | export DISPLAY=:1.0 && \ | 29 | export DISPLAY=:1.0 && \ |
23 | touch ~/.Xauthority && \ | 30 | touch /home/developer/.Xauthority && \ |
24 | pip3 install image && \ | 31 | pip3 install image && \ |
25 | pip3 install python3-xlib && \ | 32 | pip3 install python3-xlib && \ |
26 | pip3 install pyautogui | 33 | pip3 install pyautogui |