Skip to content

Commit

Permalink
new container
Browse files Browse the repository at this point in the history
  • Loading branch information
jay-johnson committed Jun 5, 2018
1 parent fb5fedb commit 7f2ef0d
Show file tree
Hide file tree
Showing 2 changed files with 71 additions and 25 deletions.
36 changes: 31 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,42 @@ language: python
python:
- 3.6

services:
- docker

before_install:
- export PYTHONPATH=$HOME/builds/jay-johnson/network-pipeline
- export PYTHONPATH=$HOME/builds/jay-johnson/antinex-pipeline
- export PIP_USE_MIRRORS=true
- export USE_VERSION=$(cat setup.py | grep " version=" | sed -e 's/"/ /g' | awk '{print $2}')
- export REPO=jayjohnson/antinex-pipeline
- echo "Building Docker with tag=${USE_VERSION}"
- echo ""
- echo "Testing Docker Hub credentials username=${DOCKER_USERNAME}"
- docker login --username $DOCKER_USERNAME --password $DOCKER_PASSWORD
- echo "Docker Hub credentials are working"

install:
- pip install -e .

script:
# - echo "Starting Linting Tests"
# - flake8 .
# - pycodestyle --exclude=./simulations,.tox,.eggs
- echo "Starting Unit Tests"
- echo "Running Lint Tests"
- flake8
- pycodestyle
- echo "Running Unit Tests"
- python setup.py test

after_success:
- export USE_VERSION=$(cat setup.py | grep " version=" | sed -e 's/"/ /g' | awk '{print $2}')
- echo "Test Success - Branch=${TRAVIS_BRANCH} Version=${USE_VERSION} Pull Request=${TRAVIS_PULL_REQUEST} Tag=${TRAVIS_TAG}"
- if [[ "$TRAVIS_BRANCH" == "master" ]]; then echo -e "Push Container to Docker Hub"; fi
- echo "Logging into Docker Hub"
- docker login --username $DOCKER_USERNAME --password $DOCKER_PASSWORD
- export TAG=`if [ "$TRAVIS_BRANCH" == "master" ]; then echo "latest"; else echo $TRAVIS_BRANCH ; fi`
- echo "starting: docker build -f Dockerfile -t ${REPO} ."
- docker build -f Dockerfile -t $REPO .
- echo "docker tag ${REPO} ${REPO}:${USE_VERSION}"
- docker tag $REPO $REPO:$USE_VERSION
- echo "docker push ${REPO}"
- docker push $REPO:latest
- echo "docker push ${REPO}:${USE_VERSION}"
- docker push $REPO:$USE_VERSION
60 changes: 40 additions & 20 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,25 +1,45 @@
FROM jayjohnson/celery-connectors:latest
FROM jayjohnson/ai-core:latest

RUN apk add --update \
gcc \
linux-headers
RUN echo "creating project directories" \
&& mkdir -p -m 777 /var/log/antinex/pipeline \
&& mkdir -p -m 777 /opt/antinex \
&& chmod 777 //var/log/antinex/pipeline \
&& touch /var/log/antinex/pipeline/latest-packets-redis.log \
&& touch /var/log/antinex/pipeline/latest-packets-rabbitmq.log \
&& chmod 777 /var/log/antinex/pipeline/latest-packets-redis.log \
&& chmod 777 /var/log/antinex/pipeline/latest-packets-rabbitmq.log \
&& echo "updating repos" \
&& cd /opt/antinex/pipeline \
&& git checkout master
&& git pull
&& "checking repos in container" \
&& ls -l /opt/antinex/pipeline \
&& echo "installing utils" \
&& . /opt/venv/bin/activate \
&& cd /opt/antinex/pipeline \
&& echo "installing pip upgrades" \
&& pip install --upgrade -e . \
&& echo "building docs" \
&& cd /opt/antinex/pipeline/docs \
&& ls -l \
&& make html

ENV START_SCRIPT /opt/networkpipeline/network_pipeline/scripts/start-container.sh
ENV LOG_CFG /opt/networkpipeline/network_pipeline/log/colors-logging.json
ENV PROJECT_NAME pipeline
SHARED_LOG_CFG /opt/antinex/core/antinex_core/log/debug-openshift-logging.json
DEBUG_SHARED_LOG_CFG 0
LOG_LEVEL DEBUG
LOG_FILE /var/log/antinex/pipeline/latest-packets-redis.log
USE_ENV drf-dev
USE_VENV /opt/venv
API_DEBUG false
USE_FILE false
SILENT -s

RUN mkdir -p -m 777 /opt/networkpipeline
WORKDIR /opt/antinex/pipeline

COPY network-pipeline-latest.tgz /opt/networkpipeline
# set for anonymous user access in the container
RUN find /opt/antinex/pipeline -type d -exec chmod 777 {} \;
RUN find /var/log/antinex -type d -exec chmod 777 {} \;

RUN cd /opt/networkpipeline \
&& tar xvf network-pipeline-latest.tgz \
&& ls /opt/networkpipeline \
&& cd /opt/networkpipeline \
&& ls -l /opt/networkpipeline \
&& source /opt/celery_connectors/venv/bin/activate \
&& pip install -e . \
&& pip list --format=columns

WORKDIR /opt/networkpipeline

ENTRYPOINT /opt/networkpipeline/network_pipeline/scripts/start-container.sh
ENTRYPOINT . /opt/venv/bin/activate \
&& network_pipeline/scripts/packets_redis.py

0 comments on commit 7f2ef0d

Please sign in to comment.