This repository has been archived by the owner on Sep 15, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
21 changed files
with
461 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
venv/ | ||
.git/ | ||
.buildozer/ | ||
.pytest_cache/ | ||
.tox/ | ||
opencv* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
sudo: required | ||
|
||
language: generic | ||
|
||
services: | ||
- docker | ||
|
||
env: | ||
global: | ||
- DISPLAY=:99.0 | ||
matrix: | ||
- TAG=zbarcam-linux DOCKERFILE=dockerfiles/Dockerfile-linux COMMAND='make test' | ||
- TAG=zbarcam-linux DOCKERFILE=dockerfiles/Dockerfile-linux COMMAND='make uitest' | ||
- TAG=zbarcam-android DOCKERFILE=dockerfiles/Dockerfile-android COMMAND='buildozer android debug' | ||
|
||
before_install: | ||
- sudo apt update -qq > /dev/null | ||
- sudo apt install --yes --no-install-recommends xvfb | ||
|
||
install: | ||
- docker build --tag=$TAG --file=$DOCKERFILE . | ||
|
||
before_script: | ||
- sh -e /etc/init.d/xvfb start | ||
|
||
script: | ||
- travis_wait docker run -e DISPLAY -e CI -v /tmp/.X11-unix:/tmp/.X11-unix $TAG $COMMAND |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
VENV_NAME=venv | ||
PIP=$(VENV_NAME)/bin/pip | ||
TOX=`which tox` | ||
GARDEN=$(VENV_NAME)/bin/garden | ||
PYTHON=$(VENV_NAME)/bin/python | ||
SYSTEM_DEPENDENCIES=virtualenv build-essential libpython2.7-dev libsdl2-dev libzbar-dev \ | ||
cmake python-numpy tox wget curl | ||
OS=$(shell lsb_release -si) | ||
OPENCV_VERSION=2.4.13.6 | ||
OPENCV_BASENAME=opencv-$(OPENCV_VERSION) | ||
OPENCV_BUILD=$(OPENCV_BASENAME)/build/lib/cv2.so | ||
OPENCV_DEPLOY=$(VENV_NAME)/lib/python2.7/site-packages/cv2.so | ||
NPROC=`grep -c '^processor' /proc/cpuinfo` | ||
|
||
|
||
all: system_dependencies opencv virtualenv | ||
|
||
virtualenv: | ||
test -d venv || virtualenv -p python2 venv | ||
. venv/bin/activate | ||
$(PIP) install Cython==0.26.1 | ||
$(PIP) install -r requirements/requirements.txt | ||
$(GARDEN) install xcamera | ||
|
||
system_dependencies: | ||
ifeq ($(OS), Ubuntu) | ||
sudo apt install --yes --no-install-recommends $(SYSTEM_DEPENDENCIES) | ||
endif | ||
|
||
$(OPENCV_BUILD): | ||
curl --location https://github.com/opencv/opencv/archive/$(OPENCV_VERSION).tar.gz \ | ||
--progress-bar --output $(OPENCV_BASENAME).tar.gz | ||
tar -xf $(OPENCV_BASENAME).tar.gz | ||
cmake \ | ||
-D BUILD_DOCS=OFF -D BUILD_PACKAGE=OFF -D BUILD_PERF_TESTS=OFF \ | ||
-D BUILD_TESTS=OFF -D BUILD_opencv_apps=OFF \ | ||
-D BUILD_opencv_nonfree=OFF -D BUILD_opencv_stitching=OFF \ | ||
-D BUILD_opencv_superres=OFF -D BUILD_opencv_ts=OFF \ | ||
-D BUILD_WITH_DEBUG_INFO=OFF -D WITH_1394=OFF -D WITH_CUDA=OFF \ | ||
-D WITH_CUFFT=OFF -D WITH_GIGEAPI=OFF -D WITH_JASPER=OFF \ | ||
-D WITH_OPENEXR=OFF -D WITH_PVAPI=OFF -D WITH_GTK=OFF \ | ||
-D BUILD_opencv_python=ON -B$(OPENCV_BASENAME)/build -H$(OPENCV_BASENAME) | ||
cmake --build $(OPENCV_BASENAME)/build -- -j$(NPROC) | ||
|
||
opencv_build: $(OPENCV_BUILD) | ||
|
||
$(OPENCV_DEPLOY): opencv_build virtualenv | ||
cp $(OPENCV_BUILD) $(OPENCV_DEPLOY) | ||
|
||
opencv: $(OPENCV_DEPLOY) | ||
|
||
clean: | ||
rm -rf $(VENV_NAME) .tox/ $(OPENCV_BASENAME) | ||
|
||
test: | ||
$(TOX) | ||
|
||
uitest: virtualenv | ||
$(PIP) install -r requirements/test_requirements.txt | ||
$(PYTHON) -m unittest discover --top-level-directory=. --start-directory=tests/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
# Docker image for building Android APKs via buildozer | ||
# Build with: | ||
# docker build --tag=zbarcam-android --file=dockerfiles/Dockerfile-android . | ||
# Run with: | ||
# docker run zbarcam-android /bin/sh -c 'buildozer android debug' | ||
# Or using the entry point shortcut: | ||
# docker run zbarcam-android 'buildozer android debug' | ||
# Or for interactive shell: | ||
# docker run -it --rm zbarcam-android | ||
FROM ubuntu:18.04 | ||
|
||
ENV USER="user" | ||
ENV HOME_DIR="/home/${USER}" | ||
ENV WORK_DIR="${HOME_DIR}" \ | ||
PATH="${HOME_DIR}/.local/bin:${PATH}" | ||
ENV DOCKERFILES_VERSION="master" \ | ||
DOCKERFILES_URL="https://raw.githubusercontent.com/AndreMiras/dockerfiles" | ||
ENV MAKEFILES_URL="${DOCKERFILES_URL}/${DOCKERFILES_VERSION}/buildozer_android_new" | ||
|
||
|
||
# configure locale | ||
RUN apt update -qq > /dev/null && apt install -qq --yes --no-install-recommends \ | ||
locales && \ | ||
locale-gen en_US.UTF-8 | ||
ENV LANG="en_US.UTF-8" \ | ||
LANGUAGE="en_US.UTF-8" \ | ||
LC_ALL="en_US.UTF-8" | ||
|
||
# install system dependencies (required to setup all the tools) | ||
RUN apt install -qq --yes --no-install-recommends \ | ||
cmake make curl ca-certificates xz-utils unzip openjdk-8-jdk sudo \ | ||
python-pip python-setuptools zip | ||
|
||
# install build dependencies (required to successfully build the project) | ||
# TODO: should this go to a Makefile instead so it can be shared/reused? | ||
RUN apt install -qq --yes --no-install-recommends \ | ||
python3.6 libpython3.6-dev python3-setuptools \ | ||
file autoconf automake libtool gettext pkg-config | ||
|
||
# prepare non root env | ||
RUN useradd --create-home --shell /bin/bash ${USER} | ||
# with sudo access and no password | ||
RUN usermod -append --groups sudo ${USER} | ||
RUN echo "%sudo ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers | ||
|
||
USER ${USER} | ||
WORKDIR ${WORK_DIR} | ||
|
||
# install buildozer and dependencies | ||
RUN curl --location --progress-bar ${MAKEFILES_URL}/buildozer.mk --output buildozer.mk | ||
RUN make -f buildozer.mk | ||
# enforces buildozer master (afebba5) until next release | ||
RUN pip install --upgrade https://github.com/kivy/buildozer/archive/afebba5.zip | ||
|
||
COPY . ${WORK_DIR} | ||
ENTRYPOINT ["./dockerfiles/start.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# Docker image for installing dependencies on Linux and running tests. | ||
# Build with: | ||
# docker build --tag=zbarcam-linux --file=dockerfiles/Dockerfile-linux . | ||
# Run with: | ||
# docker run zbarcam-linux /bin/sh -c 'make test' | ||
# Or using the entry point shortcut: | ||
# docker run zbarcam-linux 'make test' | ||
# For running UI: | ||
# xhost +"local:docker@" | ||
# docker run -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix zbarcam-linux 'make uitest' | ||
# Or for interactive shell: | ||
# docker run -it --rm zbarcam-linux | ||
FROM ubuntu:18.04 | ||
|
||
ENV USER="user" | ||
ENV HOME_DIR="/home/${USER}" | ||
ENV WORK_DIR="${HOME_DIR}" | ||
|
||
# configure locale | ||
RUN apt update -qq > /dev/null && apt install --yes --no-install-recommends \ | ||
locales && \ | ||
locale-gen en_US.UTF-8 | ||
ENV LANG="en_US.UTF-8" \ | ||
LANGUAGE="en_US.UTF-8" \ | ||
LC_ALL="en_US.UTF-8" | ||
|
||
# install system dependencies | ||
RUN apt install --yes --no-install-recommends \ | ||
python python-dev virtualenv make lsb-release pkg-config build-essential \ | ||
sudo tox | ||
|
||
# install kivy system dependencies | ||
# https://kivy.org/docs/installation/installation-linux.html#dependencies-with-sdl2 | ||
RUN apt install --yes --no-install-recommends \ | ||
libsdl2-dev libsdl2-image-dev libsdl2-mixer-dev libsdl2-ttf-dev | ||
|
||
# prepare non root env | ||
RUN useradd --create-home --shell /bin/bash ${USER} | ||
# with sudo access and no password | ||
RUN usermod -append --groups sudo ${USER} | ||
RUN echo "%sudo ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers | ||
|
||
USER ${USER} | ||
WORKDIR ${WORK_DIR} | ||
COPY . ${WORK_DIR} | ||
|
||
RUN make | ||
ENTRYPOINT ["./dockerfiles/start.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
# if a some command has been passed to container, executes it and exit, | ||
# otherwise runs bash | ||
if [[ $@ ]]; then | ||
eval $@ | ||
else | ||
/bin/bash | ||
fi |
Oops, something went wrong.