Skip to content

๐Ÿณ Capsule HTTP Docker image

Capsule HTTP Docker images v0.4.2 โ›ฑ๏ธ [beach umbrella]

  • botsgarden/capsule-http-linux-arm64:0.4.2
  • botsgarden/capsule-http-linux-amd64:0.4.2

https://hub.docker.com/repositories/botsgarden

๐Ÿ‘‹ testing of these images is in progress, so please be patient ๐Ÿ™

How to use it

GOOS="linux" 
GOARCH="arm64"
IMAGE_TAG="0.4.2"
IMAGE_NAME="botsgarden/capsule-http-${GOOS}-${GOARCH}"

docker run \
  -p 8080:8080 \
  -v $(pwd)/functions/hello-world:/app --rm ${IMAGE_NAME}:${IMAGE_TAG} \
  /capsule-http \
    --wasm=./app/hello-world.wasm \
    --httpPort=8080

Dockerize Capsule HTTP and a WASM module

Create a new Dockerfile:

1
2
3
4
FROM botsgarden/capsule-http-linux-arm64:0.4.2
COPY hello-world.wasm .
EXPOSE 8080
CMD ["/capsule-http", "--wasm=./hello-world.wasm", "--httpPort=8080"]

Build the image:

1
2
3
4
5
IMAGE_NAME="demo-capsule-http"
docker login -u ${DOCKER_USER} -p ${DOCKER_PWD}
docker build -t ${IMAGE_NAME} . 

docker images | grep ${IMAGE_NAME}

Run the container:

1
2
3
4
IMAGE_NAME="demo-capsule-http"
docker run \
  -p 8080:8080 \
  --rm ${IMAGE_NAME}

Call the service:

1
2
3
4
JSON_DATA='{"name":"Bob Morane","age":42}'
curl -X POST http://localhost:8080 \
  -H 'Content-Type: application/json; charset=utf-8' \
  -d "${JSON_DATA}"