Docker image for the @liquicode/serverkit node package.
252
This is the official docker image for the @liquicode/serverkit library.
You can find the standard docker image of ServerKit here.
This image exposes port 8080 (for Web traffic) and 8081 (for WebSocket traffic). and requires that the server's main folder is mounted on the running container.
If you need to run different ports, you will have to modify the docker build script below and build a custom image.
For example, to run the MathsServer sample, we need to specify the path to the MathServer folder and also publish the ports we need for Web and WebSocket transports.
You could use the following Docker call in a script:
# run-maths.sh:
docker run -it \
--name MathsServer \ # container name (optional)
--publish 80:8080/tcp \ # Web traffic on port 80
--publish 81:8081/tcp \ # WebSocket traffic on port 81
--mount type=bind,source=~/MathsServer,target=/server \ # Mount the Server Folder (code and data)
agbowlin/serverkit \ # this docker image
--folder /server \ # The mounted Server Folder
--name MathsServer \ # Server name (required)
--options MathsServer.options.json \ # options file in Server Folder
$@ # pass rest of command line to SerevrKit
Then to run the MathsServer, view the log output, and interact with the web components:
bash run-maths.sh --shell run
Use it to discover available services and functions:
$ bash run-maths.sh list
Authentication # <-- services in this server
ServerAccounts
ServerManagement
Maths
$ bash run-maths.sh list Maths
Add # <-- service functions/origins
Subtract
Multiple
Divide
Use it to invoke services from the command line:
$ bash run-maths.sh call Maths.Multiply 6 7
42 # <-- call the service and prints the answer
Aee also: ServerKit command line usage
Here are some generic scripts which will instantiate a ServerKit server
in your current working directory.
Note that the --name parameter is required when running these scripts.
Linux/Mac
# serverkit-here.sh:
docker run -it \
--publish 8080:8080/tcp \
--publish 8081:8081/tcp \
--mount type=bind,source=$(pwd),target=/server \
agbowlin/serverkit \
--folder /server \
$@
# Run serverkit in this folder
bash serverkit-here.sh --name MyServer list
bash serverkit-here.sh --name MyServer run
Windows
# serverkit-here.bat:
docker run -it ^
--publish 8080:8080/tcp ^
--publish 8081:8081/tcp ^
--mount type=bind,source=%cd%,target=/server ^
agbowlin/serverkit ^
--folder /server ^
%*
# Run serverkit in this folder
serverkit-here.bat --name MyServer run
FROM node:14
LABEL name="@liquicode/serverkit"
# Install ServerKit
WORKDIR /home/serverkit
RUN npm init -Y
RUN npm install @liquicode/serverkit
# Expose default port for Web traffic
EXPOSE 8080
# Expose default port for WebSocket traffic
EXPOSE 8081
# Set the Entrypoint
ENTRYPOINT [ "npx", "@liquicode/serverkit" ]
Distributions
Support
Content type
Image
Digest
sha256:69dfa286f…
Size
385.7 MB
Last updated
almost 4 years ago
docker pull agbowlin/serverkit