Skip to content

Commit

Permalink
Add Dockerfile and Makefile (#8)
Browse files Browse the repository at this point in the history
  • Loading branch information
rahulanand16nov authored May 12, 2022
1 parent 1f49c26 commit 6e697ff
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 17 deletions.
38 changes: 21 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,26 @@ A Proxy-Wasm module written in Rust, acting as a shim between Envoy and Limitado
Following is a sample configuration used by the shim.

```yaml
failure_mode_deny: true,
failure_mode_deny: true
ratelimitpolicies:
- ratelimitpolicy-1:
hosts: ["*.toystore.com"]
rules:
- operations:
- paths: ["/toy*"]
methods: ["GET"]
actions:
- generic_key:
descriptor_key: "get-toy"
descriptor_value: "yes"
global_actions:
- generic_key:
descriptor_key: "vhost-hit"
descriptor_value: "yes"
upstream_cluster: "limitador" # Should match cluster name in envoy
domain: "toystore"
default/toystore:
hosts:
- "*.toystore.com"
rules:
- operations:
- paths:
- "/admin/toy"
methods:
- POST
- DELETE
actions:
- generic_key:
descriptor_value: 'yes'
descriptor_key: admin
global_actions:
- generic_key:
descriptor_value: 'yes'
descriptor_key: vhaction
upstream_cluster: rate-limit-cluster
domain: toystore-app
```
3 changes: 3 additions & 0 deletions deploy/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
FROM scratch

COPY wasm_shim.wasm /plugin.wasm
16 changes: 16 additions & 0 deletions deploy/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
MKFILE_PATH := $(abspath $(lastword $(MAKEFILE_LIST)))
PROJECT_PATH := $(patsubst %/,%,$(dir $(MKFILE_PATH)))
IMAGE_VERSION ?= latest
DOCKER ?= podman

.PHONY: build
build:
$(DOCKER) build -t quay.io/rahanand/wasm-shim:$(IMAGE_VERSION) -f $(PROJECT_PATH)/Dockerfile

.PHONY: clean
clean:
$(DOCKER) rmi quay.io/rahanand/wasm-shim:$(IMAGE_VERSION)

.PHONY: push
push:
$(DOCKER) push quay.io/rahanand/wasm-shim:$(IMAGE_VERSION)

0 comments on commit 6e697ff

Please sign in to comment.