diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..f9dd1924 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,33 @@ +FROM ubuntu:18.04 + +# Install system packages/dependencies +RUN apt-get --yes update \ + && apt-get --no-install-recommends --yes install libcurl3 \ + && rm -rf /var/lib/apt/lists/* + +# Copy minimal set of ChatScript files +COPY ./BINARIES/LinuxChatScript64 /opt/ChatScript/BINARIES/ +COPY ./DICT/ENGLISH/*.bin /opt/ChatScript/DICT/ENGLISH/ +COPY ./LIVEDATA/SYSTEM /opt/ChatScript/LIVEDATA/SYSTEM +COPY ./LIVEDATA/ENGLISH /opt/ChatScript/LIVEDATA/ENGLISH +COPY ./TOPIC/BUILD0 /opt/ChatScript/TOPIC/BUILD0 + +# Make binary executable +RUN chmod +x /opt/ChatScript/BINARIES/LinuxChatScript64 + +# Create entrypoint script so we can pass args and Ctrl+C out +RUN { \ +echo '#!/bin/bash'; \ +echo 'set -e'; \ +echo '/opt/ChatScript/BINARIES/LinuxChatScript64 $@'; \ +} > /entrypoint-chatscript.sh \ +&& chmod +x /entrypoint-chatscript.sh + +# Declare volumes for mount point directories +VOLUME ["/opt/ChatScript/USERS/", "/opt/ChatScript/LOGS/"] + +# Set runtime properties +ENV LANG C.UTF-8 +EXPOSE 1024 +WORKDIR /opt/ChatScript/BINARIES +ENTRYPOINT ["/entrypoint-chatscript.sh"] diff --git a/README.md b/README.md index c059fc66..8e456fa6 100644 --- a/README.md +++ b/README.md @@ -174,6 +174,43 @@ The result will go in the `BINARIES` directory. On Linux, go stand in the SRC directory and type `make server` (assuming you have make and g++ installed). This creates BINARIES/ChatScript, which can run as a server or locally. There are other make choices for installing PostGres or Mongo. +## Docker image + +### Building the base Docker image + +The `Dockerfile` in this repository provides a ChatScript server with no bots. To build and run it, run the following commands: + +``` +docker build -t chatscript . +docker run -it -p 1024:1024 chatscript +``` + +Note: You will probably want to replace the image tag `chatscript` with a more meaningful one for your purposes. + +### Building a Docker image containing bot data + +Adding bot data to the base image above is as simple as writing a `Dockerfile` like the following one, which builds the `Harry` bot: + +``` +FROM chatscript + +# Copy raw data needed for Harry +COPY ./RAWDATA/filesHarry.txt +COPY ./RAWDATA/HARRY /opt/ChatScript/RAWDATA/HARRY +COPY ./RAWDATA/QUIBBLE /opt/ChatScript/RAWDATA/QUIBBLE + +# Build Harry +RUN /opt/ChatScript/BINARIES/LinuxChatScript64 local build1=filesHarry.txt +``` + +This `Dockerfile` can then be built and run in the same manner as the base `chatscript` image: + +``` +docker build -t chatscript-harry . +docker run -it chatscript-harry local +``` + + # Full Documentation [ChatScript Wiki (user guides, tutorials, papers)](/WIKI/README.md)