|
3 | 3 |
|
4 | 4 | - [Overview](#overview) |
5 | 5 | - [Docker Image](#docker-image) |
| 6 | + - [Distroless Base Image](#distroless-base-image) |
| 7 | + - [Benefits of Distroless:](#benefits-of-distroless) |
| 8 | + - [Debugging with Distroless:](#debugging-with-distroless) |
6 | 9 | - [Supported Envoy APIs](#supported-envoy-apis) |
7 | 10 | - [API Deprecation History](#api-deprecation-history) |
8 | 11 | - [Building and Testing](#building-and-testing) |
@@ -80,6 +83,28 @@ decision is then returned to the caller. |
80 | 83 |
|
81 | 84 | For every main commit, an image is pushed to [Dockerhub](https://hub.docker.com/r/envoyproxy/ratelimit/tags?page=1&ordering=last_updated). There is currently no versioning (post v1.4.0) and tags are based on commit sha. |
82 | 85 |
|
| 86 | +## Distroless Base Image |
| 87 | + |
| 88 | +The Docker image uses Google's [distroless](https://github.com/GoogleContainerTools/distroless) base image (`gcr.io/distroless/static-debian12`) for enhanced security and minimal attack surface. Distroless images contain only the application and its runtime dependencies, omitting unnecessary OS components like package managers, shells, and other utilities. |
| 89 | + |
| 90 | +### Benefits of Distroless: |
| 91 | + |
| 92 | +- **Enhanced Security**: Minimal attack surface with no unnecessary components |
| 93 | +- **Smaller Image Size**: Significantly smaller than traditional base images |
| 94 | +- **Reduced Vulnerabilities**: Fewer components means fewer potential security issues |
| 95 | +- **Better Compliance**: Meets security requirements for minimal base images |
| 96 | + |
| 97 | +### Debugging with Distroless: |
| 98 | + |
| 99 | +For debugging purposes, you can use the debug variant of the distroless image: |
| 100 | + |
| 101 | +```dockerfile |
| 102 | +FROM gcr.io/distroless/static-debian12:debug |
| 103 | +COPY --from=build /go/bin/ratelimit /bin/ratelimit |
| 104 | +``` |
| 105 | + |
| 106 | +This provides shell access and debugging tools while maintaining the security benefits of distroless. |
| 107 | + |
83 | 108 | # Supported Envoy APIs |
84 | 109 |
|
85 | 110 | [v3 rls.proto](https://github.com/envoyproxy/data-plane-api/blob/master/envoy/service/ratelimit/v3/rls.proto) is currently supported. |
@@ -132,14 +157,13 @@ Support for [v2 rls proto](https://github.com/envoyproxy/data-plane-api/blob/mas |
132 | 157 |
|
133 | 158 | ## Docker-compose setup |
134 | 159 |
|
135 | | -The docker-compose setup has three containers: redis, ratelimit-build, and ratelimit. In order to run the docker-compose setup from the root of the repo, run |
| 160 | +The docker-compose setup uses a distroless-based container for the ratelimit service. In order to run the docker-compose setup from the root of the repo, run |
136 | 161 |
|
137 | 162 | ```bash |
138 | 163 | docker-compose up |
139 | 164 | ``` |
140 | 165 |
|
141 | | -The ratelimit-build container will build the ratelimit binary. Then via a shared volume the binary will be shared with the ratelimit container. This dual container setup is used in order to use a |
142 | | -a minimal container to run the application, rather than the heftier container used to build it. |
| 166 | +The ratelimit service is built using the main Dockerfile which uses Google's distroless base image for enhanced security and minimal attack surface. The distroless image contains only the application and its runtime dependencies, omitting unnecessary OS components like package managers and shells. |
143 | 167 |
|
144 | 168 | If you want to run with [two redis instances](#two-redis-instances), you will need to modify |
145 | 169 | the docker-compose.yml file to run a second redis container, and change the environment variables |
|
0 commit comments