diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 65533fbce..96c4c8571 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -20,13 +20,13 @@ stages: test:lint: stage: test script: - - make install + - make install tools - make lint test:lbry-unit: stage: test script: - - make install + - make install tools - cd lbry && HOME=/tmp coverage run -p --source=lbry -m unittest discover -vv tests.unit @@ -56,7 +56,7 @@ test:torba-integ: test:json-api: stage: test script: - - make install + - make install tools - cd lbry && HOME=/tmp coverage run -p --source=lbry scripts/generate_json_api.py diff --git a/.travis.yml b/.travis.yml index 896feb0cc..41536c126 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,13 +8,13 @@ jobs: - stage: code quality name: "pylint & mypy" install: - - make install + - make install tools script: make lint - stage: test name: "LBRY Unit Tests" install: - - make install + - make install tools script: - cd lbry && HOME=/tmp coverage run -p --source=lbry -m unittest discover -vv tests.unit after_success: @@ -43,7 +43,7 @@ jobs: - name: "Run Examples" install: - - make install + - make install tools script: - cd lbry && HOME=/tmp coverage run -p --source=lbry scripts/generate_json_api.py after_success: diff --git a/Makefile b/Makefile index 0580d6999..4007c8ebd 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,5 @@ +.PHONY: install tools lint test idea + install: pip install https://github.com/rogerbinns/apsw/releases/download/3.30.1-r1/apsw-3.30.1-r1.zip \ --global-option=fetch \ @@ -5,6 +7,8 @@ install: --global-option=build --global-option=--enable --global-option=fts5 cd torba && pip install -e . cd lbry && pip install -e . + +tools: pip install mypy==0.701 pip install coverage astroid pylint diff --git a/docker/Dockerfile.wallet_server b/docker/Dockerfile.wallet_server index 141f696da..3cd3ac9fe 100644 --- a/docker/Dockerfile.wallet_server +++ b/docker/Dockerfile.wallet_server @@ -1,44 +1,32 @@ -FROM debian:buster-slim +FROM ubuntu:19.10 ARG user=lbry - -# create an unprivileged user -RUN groupadd -g 999 $user && useradd -r -u 999 -g $user $user -RUN mkdir -p /home/$user/ -RUN chown -R $user:$user /home/$user/ - -# install python, pip, git and clean up -RUN apt-get update && \ - apt-get -y --no-install-recommends install build-essential git tar wget python3.7 python3.7-dev python3-pip && \ - rm -rf /var/lib/apt/lists/* - -# create and chown database dir ARG db_dir=/database +ARG projects_dir=/home/$user + +RUN apt-get update && \ + apt-get -y --no-install-recommends install \ + build-essential \ + python3 \ + python3-dev \ + python3-pip \ + python3-wheel \ + python3-setuptools && \ + update-alternatives --install /usr/bin/pip pip /usr/bin/pip3 1 && \ + rm -rf /var/lib/apt/lists/* + +RUN groupadd -g 999 $user && useradd -m -u 999 -g $user $user RUN mkdir -p $db_dir RUN chown -R $user:$user $db_dir -# change into our user -USER $user -WORKDIR /home/$user - -# RUN pip3 install -U pip (broken on pip 10 https://github.com/pypa/pip/issues/5240) -RUN python3.7 -m pip install --upgrade pip setuptools - -# get uvloop -RUN python3.7 -m pip install --user uvloop - -# copy lbrynet -ARG projects_dir=/home/$user COPY . $projects_dir -USER root -RUN chown -R $user:$user . -USER $user +RUN chown -R $user:$user $projects_dir -# install torba & lbry -WORKDIR $projects_dir/torba -RUN python3.7 -m pip install --user -e . -WORKDIR $projects_dir/lbry -RUN python3.7 -m pip install --user -e . +USER $user +WORKDIR $projects_dir + +RUN pip install uvloop +RUN make install RUN rm ~/.cache -rf # entry point