Docker

Containerize all things with BoxLang

Docker Images

Two distinct image tags have been published for BoxLang, each serving a specific purpose.

  • ortussolutions/boxlang:cli— This is just the BoxLang CLI in a container. You can pass expressions, run the runtime itself, use it for tooling, cron jobs, and more.

  • ortussolutions/boxlang:miniserver - This is the BoxLang MiniServer runtime packaged into a docker container.

docker pull ortussolutions/boxlang:cli
docker pull ortussolutions/boxlang:miniserver

Docker Tags

Both images are tagged with the following tags:

  • latest - The latest stable release of BoxLang

  • snapshot - The latest snapshot release of BoxLang

  • alpine-snapshot - The latest snapshot release of BoxLang on Alpine Linux

We encourage you to use the snapshot version of our images until we go stable.

Running Images

Running a command in a running container

docker exec -it CONTAINERID /usr/bin/bx.sh 2+2

Starting a docker container, run a command, and exit

docker run ortussolutions/boxlang:cli time /usr/bin/bx.sh 2+2

Starting a MiniServer

docker run -it \
   -p 8080:8080 \
   ortussolutions/boxlang:miniserver

# ARM / Apple Silicone
docker run --platform linux/amd64 \
   -it \
   -p 8080:8080 \
   ortussolutions/boxlang:miniserver

Docker Compose for Images

Two example compose files are included below.

Docker Compose for BoxLang CLI

version: "2.1"

services:
  cli:
    image: ortussolutions/boxlang:cli

MiniServer

version: "2.1"

services:
  bxweb:
    image: docker pull ortussolutions/boxlang:miniserver
    environment:
      - BOXLANG_PORT=8080
      - BOXLANG_DEBUG=true
      #- BOXLANG_WEBROOT=/app
      #- BOXLANG_HOST=localhost
      # Path to boxlang.json
      #- BOXLANG_CONFIG=/path/to/boxlang.json
      # Where to store the boxlang home
      - BOXLANG_HOME=/opt/boxlang
      # - JAVA_OPTS=-Xmx512m
      - BOXLANG_MODULES=bx-compat,bx-esapi,bx-mysql
    volumes:
      - ./test:/app
      - ./test/.engine:/opt/boxlang
      - ./build:/root/build
    ports:
      - "8888:8080"

Environment Variables

The docker binary will also scan for several environment variables as overrides to the execution process.

Env VariablePurpose

BOXLANG_CONFIG = PATH

Override the boxlang.json

BOXLANG_DEBUG = BOOLEAN

Enable or disable debug mode

BOXLANG_HOME = DIRECTORY

Override the server HOME directory

BOXLANG_HOST = ip or domain

Override the localhost default to whatever IP or domain you like.

BOXLANG_PORT = 8080

Override the default port

BOXLANG_WEBROOT = path

Override the location of the web root

BOXLANG_MODULES=list

You can pass a list of module slugs you want to seed the server with. Example: bx-mysql,bx-compat,bx-esapi

Environment variables are scanned first, then the command arguments. Thus the command arguments take precedence.

Modules

The image has a module installer built in: /usr/local/bin/install-bx-module which can be used via the BOXLANG_MODULES env variable. If it detects it, then it will try to download an install those modules into the runtime's home. We recommend you do this by warming up the server first.

Runtime Source Code

The runtime source code can be found here: https://github.com/ortus-boxlang/boxlang-docker

We welcome any pull requests, testing, docs, etc.

Last updated

Logo

Copyright & Register Trademark by Ortus Solutions, Corp & Ortus Software, LLC