diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..75425f9 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,18 @@ +FROM ubuntu:trusty + +# Install the prerequisites for this +RUN sudo apt-get -y update +RUN sudo apt-get -y upgrade +RUN sudo apt-get install -y sqlite3 libsqlite3-dev python3 python3-pip +RUN pip3 install 'pyyaml>5.1' + +# Ensure that python runs everything as UTF-8 compatible +ENV PYTHONIOENCODING UTF-8 + +# Copy the project into the docker image +COPY . /project + +WORKDIR /project/bin + +# Run the database creation script +CMD [ "python3", "gendb.py"] diff --git a/README.md b/README.md index 44ef649..b374302 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,27 @@ limitations on concurrent writes won't be an issue either. ## Stop yacking and tell me how to generate the database from the YAMl! -Ok! +Ok! There are two ways of doing this; using Docker containers, and manually +setting things up. If you just want to generate the database and use it, I'd +recommend Docker, if you want to actively develop this repo the manual setup +may be preferable. + +### Using Docker + +First you will need docker, you can set that up from [here](https://www.docker.com/get-started). + +The included Dockerfile is set up so that it will install the correct +dependencies and run the database generation script. This will get you a +generated database, and copy it into your working directory: + +``` +docker build -t pathfinder-2-sqlite -f .\Dockerfile . +docker run --name pathfinder-2-sqlite-container -t pathfinder-2-sqlite +docker cp pathfinder-2-sqlite-container:/project/tmp.db . +docker container rm pathfinder-2-sqlite-container +``` + +### Manual Setup You'll need a working python3 installation and the module `pyyaml` installed. diff --git a/bin/gendb.py b/bin/gendb.py index 9645050..45a70bf 100644 --- a/bin/gendb.py +++ b/bin/gendb.py @@ -11,8 +11,8 @@ import pathlib DBFILE = 'tmp.db' -DBOUTPUT_PATH = pathlib.Path().absolute().parent -DATA_PATH = pathlib.Path().absolute().parent / 'data' +DBOUTPUT_PATH = str(pathlib.Path().absolute().parent) +DATA_PATH = str(pathlib.Path().absolute().parent / 'data') def main():