Skip to content

Commit

Permalink
Reduce image size and better instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
yanokwa committed Oct 17, 2019
1 parent e6fac6e commit ca7d707
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 13 deletions.
19 changes: 9 additions & 10 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
FROM tiangolo/uwsgi-nginx-flask:python3.7

COPY requirements.txt /tmp/
RUN pip install -r /tmp/requirements.txt

RUN apt-get update && apt-get install -y openjdk-8-jre-headless
# Needed to prevent Java from AWTError Assistive Technology not found
RUN sed -i -e '/^assistive_technologies=/s/^/#/' /etc/java-*-openjdk/accessibility.properties

COPY ./app /app
FROM tiangolo/uwsgi-nginx-flask:python3.7-alpine3.8

COPY requirements.txt /tmp/
RUN pip install --upgrade pip
RUN pip install -r /tmp/requirements.txt

RUN apk --update add openjdk8-jre-base

COPY ./app /app
20 changes: 17 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Overview
pyxform-http is a Flask-based web service that uses pyxform to convert a XLSForm to an ODK XForm.

# Requirements
# Install requirements
* Python 3
* Java

Expand All @@ -11,16 +11,30 @@ pip install -r requirements.txt
FLASK_APP=app/main.py FLASK_DEBUG=1 flask run
```

# Run in a Docker container
# Run in Docker
```
docker build -t pyxform-http .
docker run -d --name pyxform-http -p 80:80 pyxform-http
```

# Test
# Test forms

A form that converts successfully
```
curl --request POST --data-binary @test/pyxform-clean.xlsx http://127.0.0.1/api/v1/convert
```

A form that fails to convert and returns a pyxform error
```
curl --request POST --data-binary @test/pyxform-error.xlsx http://127.0.0.1/api/v1/convert
```

A form that converts successfully and also returns pyxform warnings
```
curl --request POST --data-binary @test/pyxform-warning.xlsx http://127.0.0.1/api/v1/convert
```

A form that passes pyxform's internal checks, but fails ODK Validate's checks
```
curl --request POST --data-binary @test/validate-error.xlsx http://127.0.0.1/api/v1/convert
```

0 comments on commit ca7d707

Please sign in to comment.