use make install in Dockerfile

This commit is contained in:
Lex Berezhny 2019-12-07 23:38:54 -05:00
parent 13f9370f8c
commit 3ef96404ee
4 changed files with 31 additions and 39 deletions

View file

@ -20,13 +20,13 @@ stages:
test:lint: test:lint:
stage: test stage: test
script: script:
- make install - make install tools
- make lint - make lint
test:lbry-unit: test:lbry-unit:
stage: test stage: test
script: script:
- make install - make install tools
- cd lbry && HOME=/tmp coverage run -p --source=lbry -m unittest discover -vv tests.unit - 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: test:json-api:
stage: test stage: test
script: script:
- make install - make install tools
- cd lbry && HOME=/tmp coverage run -p --source=lbry scripts/generate_json_api.py - cd lbry && HOME=/tmp coverage run -p --source=lbry scripts/generate_json_api.py

View file

@ -8,13 +8,13 @@ jobs:
- stage: code quality - stage: code quality
name: "pylint & mypy" name: "pylint & mypy"
install: install:
- make install - make install tools
script: make lint script: make lint
- stage: test - stage: test
name: "LBRY Unit Tests" name: "LBRY Unit Tests"
install: install:
- make install - make install tools
script: script:
- cd lbry && HOME=/tmp coverage run -p --source=lbry -m unittest discover -vv tests.unit - cd lbry && HOME=/tmp coverage run -p --source=lbry -m unittest discover -vv tests.unit
after_success: after_success:
@ -43,7 +43,7 @@ jobs:
- name: "Run Examples" - name: "Run Examples"
install: install:
- make install - make install tools
script: script:
- cd lbry && HOME=/tmp coverage run -p --source=lbry scripts/generate_json_api.py - cd lbry && HOME=/tmp coverage run -p --source=lbry scripts/generate_json_api.py
after_success: after_success:

View file

@ -1,3 +1,5 @@
.PHONY: install tools lint test idea
install: install:
pip install https://github.com/rogerbinns/apsw/releases/download/3.30.1-r1/apsw-3.30.1-r1.zip \ pip install https://github.com/rogerbinns/apsw/releases/download/3.30.1-r1/apsw-3.30.1-r1.zip \
--global-option=fetch \ --global-option=fetch \
@ -5,6 +7,8 @@ install:
--global-option=build --global-option=--enable --global-option=fts5 --global-option=build --global-option=--enable --global-option=fts5
cd torba && pip install -e . cd torba && pip install -e .
cd lbry && pip install -e . cd lbry && pip install -e .
tools:
pip install mypy==0.701 pip install mypy==0.701
pip install coverage astroid pylint pip install coverage astroid pylint

View file

@ -1,44 +1,32 @@
FROM debian:buster-slim FROM ubuntu:19.10
ARG user=lbry ARG user=lbry
ARG db_dir=/database
ARG projects_dir=/home/$user
# 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 && \ RUN apt-get update && \
apt-get -y --no-install-recommends install build-essential git tar wget python3.7 python3.7-dev python3-pip && \ 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/* rm -rf /var/lib/apt/lists/*
# create and chown database dir RUN groupadd -g 999 $user && useradd -m -u 999 -g $user $user
ARG db_dir=/database
RUN mkdir -p $db_dir RUN mkdir -p $db_dir
RUN chown -R $user:$user $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 COPY . $projects_dir
USER root RUN chown -R $user:$user $projects_dir
RUN chown -R $user:$user .
USER $user
# install torba & lbry USER $user
WORKDIR $projects_dir/torba WORKDIR $projects_dir
RUN python3.7 -m pip install --user -e .
WORKDIR $projects_dir/lbry RUN pip install uvloop
RUN python3.7 -m pip install --user -e . RUN make install
RUN rm ~/.cache -rf RUN rm ~/.cache -rf
# entry point # entry point