Skip to content

Commit

Permalink
change uid in docker for local development; use volumes instead copy …
Browse files Browse the repository at this point in the history
…everything; try fix cov. reports
  • Loading branch information
agnesk92 committed May 20, 2020
1 parent 9ba264f commit 4059b99
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 9 deletions.
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ before_install:
jobs:
include:
- name: PyTest With Coverage
script: docker run -ti -v "$PWD/shared:/shared" pyghost:v1.0 bash -c "pytest --cov=./ --cov-report=xml:/shared/coverage.xml"
script: docker run -ti -v "$PWD/shared:/shared" -v "$PWD:/app" pyghost:v1.0 bash -c "pytest --cov=./ --cov-report=xml:/shared/coverage.xml"

after_success:
- curl -s https://codecov.io/bash | bash
- ./cc-test-reporter after-build -t clover -p shared --exit-code $TRAVIS_TEST_RESULT
- ./cc-test-reporter after-build -t clover -p shared/coverage.xml --exit-code $TRAVIS_TEST_RESULT
7 changes: 4 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@ MAINTAINER Agnes Kis

RUN mkdir /app
WORKDIR /app
COPY . /app
COPY ./requirements.txt /app

RUN pip install -r requirements.txt

# Change from root user for security reasons
RUN useradd -r -U -s /bin/bash pygameuser
RUN mkdir /shared && chown -R pygameuser:pygameuser /shared /app
RUN useradd -r -U -s /bin/bash pygameuser && usermod -u 1000 pygameuser
RUN mkdir /shared && chown -R pygameuser:pygameuser /app /shared
RUN echo $(id -u)
USER pygameuser
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,17 @@ docker build . -t pyghost-ubuntu:v1.0
docker build --no-cache . -t pyghost-ubuntu:v1.0

# Depending on the OS you are using sh or bash ..
docker run -it pyghost-ubuntu:v1.0 sh
docker run -it pyghost-ubuntu:v1.0 bash
docker run --rm -v `pwd`:/app -it pyghost-ubuntu:v1.0 sh
docker run --rm -v `pwd`:/app -it pyghost-ubuntu:v1.0 bash

# Linux setups - might need for host display access
# If needed for display env var: ip route list | grep default
xhost +local:docker

# For GUI apps, use the host's X11 server and DISPLAY
# https://stackoverflow.com/questions/28392949/running-chromium-inside-docker-gtk-cannot-open-display-0
docker run --env DISPLAY=unix$DISPLAY --volume $XAUTH:/root/.Xauthority --volume /tmp/.X11-unix:/tmp/.X11-unix --rm -it pyghost-ubuntu:v1.0 bash
docker run --env DISPLAY=unix$DISPLAY --volume $XAUTH:/root/.Xauthority --volume /tmp/.X11-unix:/tmp/.X11-unix --volume `pwd`:/app --rm -it pyghost-ubuntu:v1.0 bash
docker run --rm --env DISPLAY=unix$DISPLAY -v $XAUTH:/root/.Xauthority -v /tmp/.X11-unix:/tmp/.X11-unix -it pyghost-ubuntu:v1.0 bash
docker run --rm --env DISPLAY=unix$DISPLAY -v $XAUTH:/root/.Xauthority -v /tmp/.X11-unix:/tmp/.X11-unix -v `pwd`:/app -it pyghost-ubuntu:v1.0 bash
# docker exec -it pyghost-ubuntu:v1.0 bash

python run_game.py
Expand Down
Empty file removed entrypoint.sh
Empty file.
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ numpy
codecov
coverage
pytest-cov
pylint

0 comments on commit 4059b99

Please sign in to comment.