Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# these values configure the build of the docker images
BUILD_TAG=latest
DOCKER_REPO=cwolff
DEVTOOLS=false

# the port on which the api will be available
Expand Down
9 changes: 8 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,15 @@ jobs:
- name: Tests
stage: test
script: make test
before_script: docker pull cwolff/face_recognition
before_script: docker pull cwolff/faceanalysis_facerecognition

stages:
- lint
- test

deploy:
provider: script
script: docker login -u "${DOCKER_USER}" -p "${DOCKER_PASSWORD}" && for tag in "${TRAVIS_TAG}" "latest"; do make release-server release-algorithms -e build_tag="${tag}" -e docker_repo="${DOCKER_USER}"; done
on:
tags: true
repo: c-w/faceanalysis
26 changes: 22 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,12 +1,30 @@
SHELL=/bin/bash
SHELL = /bin/bash
build_tag := $(shell grep '^BUILD_TAG=' .env | cut -d'=' -f2-)
docker_repo := $(shell grep '^DOCKER_REPO=' .env | cut -d'=' -f2-)

.PHONY: build-dev build-prod pylint flake8 mypy lint test
.PHONY: build-dev build-prod build-algorithms release-server release-algorithms pylint flake8 mypy lint test

build-dev:
DEVTOOLS="true" docker-compose build
DOCKER_REPO="$(docker_repo)" BUILD_TAG="$(build_tag)" DEVTOOLS="true" \
docker-compose build

build-prod:
docker-compose build
DOCKER_REPO="$(docker_repo)" BUILD_TAG="$(build_tag)" \
docker-compose build

build-algorithms:
docker build -t "$(docker_repo)/faceanalysis_facerecognition:$(build_tag)" algorithms/face_recognition
docker build -t "$(docker_repo)/faceanalysis_faceapi:$(build_tag)" algorithms/FaceApi
docker build -t "$(docker_repo)/faceanalysis_facenet:$(build_tag)" algorithms/facenet

release-server: build-prod
DOCKER_REPO="$(docker_repo)" BUILD_TAG="$(build_tag)" \
docker-compose push

release-algorithms: build-algorithms
docker push "$(docker_repo)/faceanalysis_facerecognition:$(build_tag)"
docker push "$(docker_repo)/faceanalysis_faceapi:$(build_tag)"
docker push "$(docker_repo)/faceanalysis_facenet:$(build_tag)"

pylint: build-dev
docker-compose run --rm --no-deps --entrypoint=python3 api -m pylint /app/faceanalysis
Expand Down
10 changes: 4 additions & 6 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ services:

nginx:
restart: always
image: faceanalysis_nginx:${BUILD_TAG}
image: ${DOCKER_REPO}/faceanalysis_nginx:${BUILD_TAG}
build: ./nginx
logging:
driver: "json-file"
Expand All @@ -16,7 +16,7 @@ services:

worker:
restart: always
image: faceanalysis_app:${BUILD_TAG}
image: ${DOCKER_REPO}/faceanalysis_app:${BUILD_TAG}
build:
context: ./app
args:
Expand Down Expand Up @@ -52,7 +52,7 @@ services:

api:
restart: always
image: faceanalysis_app:${BUILD_TAG}
image: ${DOCKER_REPO}/faceanalysis_app:${BUILD_TAG}
build:
context: ./app
args:
Expand Down Expand Up @@ -93,12 +93,10 @@ services:
environment:
RABBITMQ_DEFAULT_USER: ${RABBITMQ_USER}
RABBITMQ_DEFAULT_PASS: ${RABBITMQ_PASSWORD}
ports:
- 15672:15672

mysql:
restart: always
image: faceanalysis_mysql:${BUILD_TAG}
image: ${DOCKER_REPO}/faceanalysis_mysql:${BUILD_TAG}
build: ./mysql
logging:
driver: "json-file"
Expand Down