diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml new file mode 100644 index 0000000..c7cdb8a --- /dev/null +++ b/.github/workflows/docker-publish.yml @@ -0,0 +1,43 @@ +name: Docker Build and Publish + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + +env: + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository }} + +jobs: + build-and-push-image: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Log in to the Container registry + uses: docker/login-action@v1 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@v3 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + + - name: Build and push Docker image + uses: docker/build-push-action@v2 + with: + context: . + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} \ No newline at end of file diff --git a/README.md b/README.md index 5e0260c..01ecd77 100644 --- a/README.md +++ b/README.md @@ -64,6 +64,26 @@ go build . ./jrpc-interceptor -debug=${LOG_SERVER_DEBUG:-true} -listenSyslog=${LOG_SERVER_URL:-"0.0.0.0:514"} -listenHTTP=${PROMETHEUS_URL:-"0.0.0.0:9100"} -usePrometheus=${USE_PROMETHEUS:-true} ``` +### Download docker image from github container registry + +1. Create a [personal access token ](https://github.com/settings/tokens)(PAT) on github with repo access +2. Set the PAT as an environment variable + +``` +export CR_PAT= +``` +3. Login to github container registry + +``` +echo $CR_PAT | docker login ghcr.io -u USERNAME --password-stdin +``` + +4. Download the image + +``` +docker pull ghcr.io/NethermindEth/jrpc-interceptor:main +``` + ## Nginx configuration All the configuration can be found inside the `nginx` folder. @@ -104,7 +124,7 @@ The interceptor publishes the following metrics: - `ngx_request_size_bytes` - the size of the request; - `ngx_response_size_bytes` - the size of the response; - `ngx_request_duration_seconds` - the time of the request; - +``` For the `ngx_request_duration_seconds` metric, we use `$request_time` value. It's the time between the first bytes were read from the client and the log write after the last bytes were sent to the client.