gocr

An OCR CLI tool implemented in golang.
Building
$ go build ./cmd/cli
<Empty output on build success>
- Build the server command:
$ go build ./cmd/server
<Empty output on build success>
Running Tests
- Run the testsuite with coverage enabled:
$ go test -coverpkg=all ./... -coverprofile=coverage.out
? github.com/TheDonDope/gocr/cmd/gocr [no test files]
? github.com/TheDonDope/gocr/pkg/config [no test files]
- Open the results in the browser:
$ go tool cover -html=coverage.out
<Opens Browser>
Running with Docker
$ docker-compose -p server build
Building server
Step 1/12 : FROM golang:1.15-buster AS builder
---> 4a581cd6feb1
Step 2/12 : LABEL maintainer="thedondope@hey.com"
---> Using cache
---> de7bdc3fcadd
Step 3/12 : WORKDIR /src
---> Using cache
---> 4ce0250120de
Step 4/12 : COPY go.mod go.sum ./
---> Using cache
---> b0ee6161c395
Step 5/12 : RUN go mod download -x
---> Using cache
---> d94c6d082b1c
Step 6/12 : COPY . ./
---> Using cache
---> 3f97a1d54c47
Step 7/12 : RUN go build -v -o /bin/server cmd/server/*.go
---> Using cache
---> 6d76a0d114ec
Step 8/12 : FROM debian:buster-slim
---> f49666103347
Step 9/12 : RUN set -x && apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y ca-certificates && rm -rf /var/lib/apt/lists/*
---> Using cache
---> f79505d005ac
Step 10/12 : WORKDIR /app
---> Using cache
---> a838cca6711f
Step 11/12 : COPY --from=builder /bin/server ./
---> Using cache
---> be056c36b528
Step 12/12 : CMD ["./server"]
---> Using cache
---> d64a6d294da8
Successfully built d64a6d294da8
Successfully tagged server_server:latest
- Run the server synchronous:
$ docker-compose -p server up
Creating gocr-server ... done
Attaching to gocr-server
gocr-server | [GIN-debug] [WARNING] Creating an Engine instance with the Logger and Recovery middleware already attached.
gocr-server |
gocr-server | [GIN-debug] [WARNING] Running in "debug" mode. Switch to "release" mode in production.
gocr-server | - using env: export GIN_MODE=release
gocr-server | - using code: gin.SetMode(gin.ReleaseMode)
gocr-server |
gocr-server | [GIN-debug] GET /healthy --> github.com/TheDonDope/gocr/pkg/http.Healthy (4 handlers)
gocr-server | [GIN-debug] Listening and serving HTTP on :4242
- Run the server as a daemonized service:
$ docker-compose -p server up -d
Starting gocr-server ... done