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:
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

View file

@ -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:

View file

@ -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

View file

@ -1,44 +1,32 @@
FROM debian:buster-slim
FROM ubuntu:19.10
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 && \
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/*
# create and chown database dir
ARG db_dir=/database
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