This section outlines the step to take to create a Docker configuration that you can use to build a WProofreader image.
To create and use a custom Docker image with WProofreader Server:
1. Clone WProofreader Docker repo.
2. Copy the WebSpellChecker/WProofreader installation package (e.g. wsc_app_x64_x.x.x.x_xx.tar.gz) to wproofreader-docker/files directory.
3. If needed, adjust the default installation options by modifying the wproofreader-docker/files/config.ini file. For details on the available options, refer to Automated Installing WebSpellChecker on Linux guide.
4. Build a Docker image using the command below:
docker build -t webspellchecker/wproofreader <path_to_Dockerfile_directory>
where:
- t is a tag that will use the 'webspellchecker/wproofreader' name,
<path_to_Dockerfile_directory> is the path to a Dockerfile directory (not to Dockerfile itself). If a Dockerfile is in the same directory, e.g. /wproofreader-docker/, you need to use the dot (.) instead of the path.
For example:
docker build -t webspellchecker/wproofreader
5. Run the latest Docker image with the following options:
docker run --mac-address="12:34:d7:b0:6b:61" -d -p 80:80 -p 2880:2880 webspellchecker/wproofreader <license_ticket_id> <your_host_name>
To use global custom and user dictionaries, your need to share a directory for the dictionaries with the Docker container. To do so, run a container as follows:
docker run --mac-address="12:34:d7:b0:6b:61" -d -p 80:80 -p 2880:2880 -v <your_directory_path>:/dictionaries webspellchecker/wproofreader <license_ticket_id> <your_host_name>
where:
- --mac-address="12:34:d7:b0:6b:61" — predefine a MAC address of Docker container to ensure the correct licensing process;
- -d start a container in detached mode;
- -p 80:80 and -p 2880:2880 — map the host port and the exposed port of container, where port 80 is a web server port and 2880 is the service port;
- -v <shared_dictionaries_directory>:/dictionaries — mount a shared directory where personal user dictionaries and global custom dictionaries will be created and stored. This is required to save the dictionaries between the starts of containers.
- webspellchecker/wproofreader - the latest tag of WProofreader Server Docker image;
- license_ticket_id - your license ticket ID;
- your_host_name - the name of a host that will be used for setup of demo samples with WProofreader. This is an optional parameter, and if nothing is specified, localhost will be used (e.g. http://localhost/wscservice/samples/).
The wproofreader-docker repo contains the following items:
- Files directory
where configureFiles.pl – configuration of samples and preparing custom/user dictionaries to be used with shared directories. It’s recommended not to modify this directory contents. - Dockerfile
- README.md
wproofreader-docker/Dockerfile
Below is the description of the commands and steps described in Dockerfile.
# the latest stable Ubuntu package. FROM ubuntu # the web server port address. EXPOSE 80 # AppServer port address. EXPOSE 2880 RUN apt-get update -y # install the latest stable version of Apache HTTP Server. RUN apt-get install -y apache2 # install the latest stable version of Apache HTTP Server. # install the latest stable version of Java Runtime Environment (JRE). It is required for the grammar engine. RUN apt-get install -y default-jre # define a constant with the name of the directory where to extract the package files. ARG DeploymentDir=downloads # define a constant with the name of the directory which will be used for shared dictionaries inside the container ARG DictionariesDir=dictionaries ARG FilesDir=./files ARG AppServerDir=/opt/WSC/AppServer ARG AppRootFolder=WSC ARG AppNameMask=wsc_app* # create a directory for deployment. RUN mkdir $DeploymentDir # create a directory for shared dictionaries. RUN mkdir $DictionariesDir # change the working directory to the deployment directory, e.g. downloads. WORKDIR /$DeploymentDir COPY $FilesDir/$AppNameMask /$DeploymentDir # extract the package contents from the archive. RUN tar -xvf $AppNameMask # delete the package achieve. RUN rm $AppNameMask # rename WSC_x.x.x into WSC. RUN mv $AppRootFolder* $AppRootFolder # copy the config.ini file to the application root directory. COPY ./files/config.ini /downloads/$AppRootFolder # change the working directory to the application root directory, e.g. WSC. WORKDIR /downloads/$AppRootFolder # run the automated installation using the config.ini file. RUN perl automated_install.pl config.ini # copy the configureFiles.pl file to the directory with the application COPY $FilesDir/configureFiles.pl $AppServerDir # copy the startService.sh file to the directory with the application COPY $FilesDir/startService.sh $AppServerDir # grant permissions to launch the file for any user. RUN chmod +x $AppServerDir/startService.sh # start the required services for the application when launching the container. ENTRYPOINT ["/opt/WSC/AppServer/startService.sh"]