-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #66 from joschrew/dockerfile
Add Makefile, Dockerfile and CI/CD
- Loading branch information
Showing
3 changed files
with
98 additions
and
0 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,37 @@ | ||
version: 2.1 | ||
jobs: | ||
|
||
build-python3: | ||
docker: | ||
- image: ocrd/core | ||
environment: | ||
PIP: pip3 | ||
PYTHON: python3 | ||
steps: | ||
- checkout | ||
- run: make install | ||
|
||
deploy-docker: | ||
docker: | ||
- image: circleci/buildpack-deps:stretch | ||
steps: | ||
- checkout | ||
- setup_remote_docker: # https://circleci.com/docs/2.0/building-docker-images/ | ||
docker_layer_caching: true | ||
- run: make docker | ||
- run: | ||
name: Login to Docker Hub | ||
command: echo "$DOCKERHUB_PASS" | docker login --username "$DOCKERHUB_USER" --password-stdin | ||
- run: docker push ocrd/segment | ||
|
||
workflows: | ||
version: 2 | ||
build-and-test: | ||
jobs: | ||
- build-python3 | ||
deploy: | ||
jobs: | ||
- deploy-docker: | ||
filters: | ||
branches: | ||
only: master |
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,20 @@ | ||
FROM ocrd/core:v2.62.0 AS base | ||
ARG VCS_REF | ||
ARG BUILD_DATE | ||
LABEL \ | ||
maintainer="https://github.com/OCR-D/ocrd_segment/issues" \ | ||
org.label-schema.vcs-ref=$VCS_REF \ | ||
org.label-schema.vcs-url="https://github.com/OCR-D/ocrd_segment" \ | ||
org.label-schema.build-date=$BUILD_DATE | ||
|
||
WORKDIR /build | ||
COPY setup.py . | ||
COPY ocrd_segment/ocrd-tool.json . | ||
COPY ocrd_segment ./ocrd_segment | ||
COPY requirements.txt . | ||
COPY README.md . | ||
RUN pip install . | ||
RUN rm -rf /build | ||
|
||
WORKDIR /data | ||
VOLUME ["/data"] |
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,41 @@ | ||
SHELL = /bin/bash | ||
PYTHON ?= python | ||
PIP ?= pip | ||
TAG ?= ocrd/segment | ||
|
||
# BEGIN-EVAL makefile-parser --make-help Makefile | ||
|
||
help: | ||
@echo "" | ||
@echo " Targets" | ||
@echo "" | ||
@echo " deps (install required Python packages)" | ||
@echo " install (install this Python package)" | ||
@echo " docker (build Docker image)" | ||
@echo "" | ||
|
||
# END-EVAL | ||
|
||
# (install required Python packages) | ||
deps: | ||
$(PIP) install -r requirements.txt | ||
|
||
#deps-test: | ||
# $(PIP) install -r requirements_test.txt | ||
|
||
# Dependencies for deployment in an ubuntu/debian linux | ||
# deps-ubuntu: | ||
# sudo apt-get install -y \ | ||
# ... | ||
|
||
# (install this Python package) | ||
install: deps | ||
$(PIP) install . | ||
|
||
docker: | ||
docker build \ | ||
-t $(TAG) \ | ||
--build-arg VCS_REF=$(git rev-parse --short HEAD) \ | ||
--build-arg BUILD_DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ") . | ||
|
||
.PHONY: help deps install docker # deps-test test |