Skip to content

Add Dockerfile and README.md to help development #35

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
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
35 changes: 35 additions & 0 deletions docker/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<p align="center">
<img src="https://raw.githubusercontent.com/camelot-dev/excalibur/master/docs/_static/excalibur-logo.png" width="200">
</p>

# Excalibur: Docker
This is the Docker configuration which allows you to run Excalibur without installing any dependencies on your machine!<br/>
OK, any except `docker`.

## Prerequisites

As stated, the thing you need is `docker`.

Follow the instructions on [Install Docker](https://docs.docker.com/engine/installation/) for your environment if you haven't got `docker` already.

## Usage

### With compose

Switch to `docker` directory and run `docker-compose up --build`

Open your browser to http://localhost and start extracting tabular data from your PDFs.

### Running the container youself

### Prepare the image

Switch to `docker` directory and run `docker build -t excalibur ./excalibur` to build your docker image. That may take some time but is only required once. Or perhaps a few times after you tweak something in a `Dockerfile`.

After the process is finished you have a `excalibur` image, that will be the base for your experiments. You can confirm that looking on results of `docker images` command.

### Run the container

From your project folder, run `docker run -it -p 5000:5000 excalibur`

That's it! Now you can go to http://localhost:5000 and start extracting tabular data from your PDFs.
17 changes: 17 additions & 0 deletions docker/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
version: "3.7"

services:

excalibur:
build: ./excalibur
container_name: excalibur
restart: always
expose:
- 5000

nginx:
build: ./nginx
container_name: nginx
restart: always
ports:
- "80:80"
21 changes: 21 additions & 0 deletions docker/excalibur/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
FROM python:3.9.4-alpine3.13

COPY requirements.txt /requirements.txt

RUN /sbin/apk add --no-cache ghostscript-dev libstdc++
RUN /sbin/apk add --no-cache --repository http://dl-cdn.alpinelinux.org/alpine/v3.9/main qt-x11
RUN /usr/local/bin/pip install --no-cache-dir --requirement /requirements.txt


EXPOSE 5000

ENV LC_ALL=C.UTF-8
ENV LANG=C.UTF-8

ENV EXCALIBUR_HOME="/excalibur" PYTHONUNBUFFERED="1"

RUN excalibur initdb
RUN cat /excalibur/excalibur.cfg | sed 's/127.0.0.1/0.0.0.0/g' > /excalibur/excalibur.tmp; \
mv /excalibur/excalibur.tmp /excalibur/excalibur.cfg
WORKDIR /excalibur/
CMD ["excalibur", "webserver"]
2 changes: 2 additions & 0 deletions docker/excalibur/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
--extra-index-url https://alpine-wheels.github.io/index
excalibur-py==0.4.3
8 changes: 8 additions & 0 deletions docker/nginx/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Use the Nginx image
FROM nginx

# Remove the default nginx.conf
RUN rm /etc/nginx/conf.d/default.conf

# Replace with our own nginx.conf
COPY nginx.conf /etc/nginx/conf.d/
9 changes: 9 additions & 0 deletions docker/nginx/nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
server {

listen 80;

location / {
proxy_pass http://excalibur:5000;
}

}