-
Notifications
You must be signed in to change notification settings - Fork 171
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add dockerfile and docker-compose.yml for easy pytest and screenshot environment #476
Conversation
I used
Switching tabs to 4-spaces on the last two lines of docker-compose.yml resolved the above error and docker container built in around 6 minutes. Jumping into the new container, many tests failed at first, but running the 3 Referencing @dbast's pr #469 resolutions here, I made progress. After adding a MANIFEST.in file w/ I note that this pr was based on 0.7.0-rc1 and not the head of the 'dev' at 5b75dbe so I'm not getting very latest bug-fixes or screenshots. |
Commit
I'm not able to recreate this. This is what I see when create a new image/container and run the pytest.
|
|
After cleaning up docker more than once, I too am unable to re-create the same errors I saw earlier. As of ee4d914 This is working for me. |
docker/Dockerfile
Outdated
|
||
RUN pip3 install -r requirements.txt | ||
RUN pip3 install -r tests/requirements.txt | ||
RUN pip3 install -e . |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could avoid the ADD . /seedsigner
and invoke the pip3 install -e .
in a bashrc file that we copy over (it could either check for "seedsigner" in pip freeze
or just run the install
on every login).
I tend to set a bashrc anyway that has terminal coloring and whatnot:
COPY docker/bashrc /root/.bashrc
case "$TERM" in
xterm-color|*-256color) color_prompt=yes;;
esac
# uncomment for a colored prompt, if the terminal has the capability; turned
# off by default to not distract the user: the focus in a terminal window
# should be on the output of commands, not on the prompt
force_color_prompt=yes
if [ -n "$force_color_prompt" ]; then
if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
# We have color support; assume it's compliant with Ecma-48
# (ISO/IEC-6429). (Lack of such support is extremely rare, and such
# a case would tend to support setf rather than setaf.)
color_prompt=yes
else
color_prompt=
fi
fi
if [ "$color_prompt" = yes ]; then
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w \$\[\033[00m\] '
else
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
fi
unset color_prompt force_color_prompt
# If this is an xterm set the title to user@host:dir
case "$TERM" in
xterm*|rxvt*)
PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
;;
*)
;;
esac
# enable color support of ls and also add handy aliases
if [ -x /usr/bin/dircolors ]; then
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
alias ls='ls --color=auto'
#alias dir='dir --color=auto'
#alias vdir='vdir --color=auto'
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
fi
cd /seedsigner
pip install -e .
I've added a setup.sh that executes when the container starts. This will run I've also updated requirements.txt to install pyzbar to ignore setuptools and just install from the GitHub repo specified. I'm open to other suggestions on how to do this in a better way. |
As of cd85142 This is still working for me. |
Another option for those who want to do development locally and run pytest and the screenshot generator without worrying about installing python 3.10 and the correct dependencies (or deal with virtualenvwrapper).
To spin up a docker container:
docker compose up -d
Then to create a shell session inside the container:
docker exec -it seedsigner-seedsigner-dev-1 bash
Then run
pytest
orpytest tests/screenshot_generator/generator.py
.