From 0ec16411337e958e024a40cd2fa79ba028770708 Mon Sep 17 00:00:00 2001 From: Jinwei Zhao Date: Tue, 15 Nov 2016 20:07:09 +0800 Subject: how to access host's screenshot inside a container? --- Dockerfile | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/Dockerfile b/Dockerfile index 94eda00..5c21fb9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,26 +1,33 @@ +# LumberJack bot +# It is difficult to dockerize this bot +# I have no idea how to access host's screenshot +# inside a docker container +# Project's present status: +# It can access mouse move inside a container +# But due to it cannot access screenshot of the host +# it cannot make decisions yet + FROM ubuntu:latest MAINTAINER clarkzjw -# Install Ubuntu and base software. RUN \ sed -i 's/# \(.*multiverse$\)/\1/g' /etc/apt/sources.list && \ apt-get update && \ apt-get -y upgrade && \ - apt-get install -y firefox sudo xvfb scrot git build-essential python3 python3-dev python3-pip python3-tk && \ - rm -rf /var/lib/apt/lists/* + apt-get install -y firefox sudo xvfb scrot git build-essential python3 python3-dev python3-pip python3-tk RUN export uid=1000 gid=1000 && \ - mkdir -p /home/developer && \ - echo "developer:x:${uid}:${gid}:Developer,,,:/home/developer:/bin/bash" >> /etc/passwd && \ - echo "developer:x:${uid}:" >> /etc/group && \ - echo "developer ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/developer && \ - chmod 0440 /etc/sudoers.d/developer && \ - chown ${uid}:${gid} -R /home/developer + mkdir -p /home/developer && \ + echo "developer:x:${uid}:${gid}:Developer,,,:/home/developer:/bin/bash" >> /etc/passwd && \ + echo "developer:x:${uid}:" >> /etc/group && \ + echo "developer ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/developer && \ + chmod 0440 /etc/sudoers.d/developer && \ + chown ${uid}:${gid} -R /home/developer RUN \ Xvfb :1 -screen 0 1366x768x16 &> xvfb.log && \ export DISPLAY=:1.0 && \ - touch ~/.Xauthority && \ + touch /home/developer/.Xauthority && \ pip3 install image && \ pip3 install python3-xlib && \ pip3 install pyautogui -- cgit v1.2.3