Skip to content

dprosper/cidr-calculator

Repository files navigation

calculator

Run on Code Engine

  1. Target your desired region.
  ibmcloud target -r us-east -g default
  1. Create the Code Engine project.
  ibmcloud code-engine project create --name calculator
  1. Create a configmap for the list of data centers (json file).
  ibmcloud code-engine configmap create \
  --name datacenters.json \
  --from-file ./data/datacenters.json 
  1. Create the application from an existing container image, expose port 3000 and map the configmap to a volume.
  ibmcloud code-engine app create -n calculator \
  --image docker.io/dprosper/calculator \
  --port 3000 \
  --mount-configmap /data=datacenters.json
  1. Optional - Update configmap
  ibmcloud code-engine configmap update \
  --name datacenters.json \
  --from-file ./data/datacenters.json 
  1. Optional - Update the application from an existing container image, exposer port 3000 and map the configmap to a volume.
  ibmcloud code-engine app update -n calculator \
  --image docker.io/dprosper/calculator \
  --port 3000 \
  --mount-configmap /data=datacenters.json

Build and run locally

Build image

  docker build -t dprosper/ic-cidr-calculator -f ./frontend-api/Dockerfile .
  docker buildx build --platform=linux/amd64 --load -t dprosper/ic-cidr-calculator -f ./frontend-api/Dockerfile .
  docker buildx build --platform=linux/amd64 -t local-build --load .

Run local

  docker run --rm -v $(pwd)/data:/data -v $(pwd)/networks:/networks -p 3000:3000 dprosper/ic-cidr-calculator

Build and run on Pull Request

Submit a pull request and the code will be deployed to Code Engine to facilitate the review.