Merge branch 'docker' into 'master'

Add ability to build this using docker

See merge request jrmiller82/pathfinder-2-sqlite!54
merge-requests/54/merge
David Corne 2021-07-23 08:45:56 +00:00
commit b908f36a8a
3 changed files with 41 additions and 3 deletions

18
Dockerfile 100644
View File

@ -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"]

View File

@ -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.

View File

@ -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():