@@ -8,15 +8,16 @@ docker compose run --rm codacy-ai
88
99Required env vars: ` CODACY_API_TOKEN ` , and ` ANTHROPIC_API_KEY ` or ` GEMINI_API_KEY ` (or both).
1010
11- > ** Docker Desktop users:** set Memory to at least 12 GB in Settings → Resources → Memory. Analysis peaks at ~ 10.5 GB.
11+ The repository at ` SOURCE_PATH ` must already be on Codacy Cloud with at least one finished analysis. The container tunes
12+ the cloud configuration via Cloud reanalysis — it does not run local analysis, and it does not import not-yet-on-Codacy
13+ repositories.
1214
1315Or from any folder, without the compose file:
1416
1517``` bash
1618docker run --rm -it \
1719 --cap-add=NET_ADMIN --cap-add=NET_RAW \
1820 --device /dev/kmsg:/dev/kmsg \
19- --memory=12g --memory-swap=12g \
2021 -v codacy-tool-cache:/home/node/.codacy \
2122 -v $( pwd) :/workspace \
2223 -e CODACY_API_TOKEN -e ANTHROPIC_API_KEY -e GEMINI_API_KEY \
@@ -29,35 +30,86 @@ Or with an explicit env file:
2930docker run --rm -it \
3031 --cap-add=NET_ADMIN --cap-add=NET_RAW \
3132 --device /dev/kmsg:/dev/kmsg \
32- --memory=12g --memory-swap=12g \
3333 -v codacy-tool-cache:/home/node/.codacy \
3434 -v $( pwd) :/workspace \
35- --env-file /path/to /.env \
35+ --env-file ./.. /.env \
3636 codacy/autoconfig
3737```
3838
39- | Flag | Purpose |
40- | ---| ---|
41- | ` --rm ` | Delete the container on exit |
42- | ` -it ` | Interactive terminal |
43- | ` --cap-add=NET_ADMIN --cap-add=NET_RAW ` | Required to enforce the outbound firewall inside the container |
44- | ` --device /dev/kmsg:/dev/kmsg ` | Kernel device needed by the firewall setup |
45- | ` --memory=12g --memory-swap=12g ` | Cap memory at 12 GB, no swap (analysis peaks ~ 10.5 GB) |
46- | ` -v codacy-tool-cache:/home/node/.codacy ` | Persistent volume so downloaded tools survive between runs |
47- | ` -v $(pwd):/workspace ` | Mounts your current folder as ` /workspace ` |
48- | ` -e ... ` | Passes API tokens from your host environment into the container |
49- | ` --env-file /path/to/.env ` | Alternative to ` -e ` flags — loads vars from a file |
39+ | Flag | Purpose |
40+ | -------------------------------------------| -----------------------------------------------------------------|
41+ | ` --rm ` | Delete the container on exit |
42+ | ` -it ` | Interactive terminal |
43+ | ` --cap-add=NET_ADMIN --cap-add=NET_RAW ` | Required to enforce the outbound firewall inside the container |
44+ | ` --device /dev/kmsg:/dev/kmsg ` | Kernel device needed by the firewall block-log stream |
45+ | ` -v codacy-tool-cache:/home/node/.codacy ` | Persistent volume so downloaded tools survive between runs |
46+ | ` -v $(pwd):/workspace ` | Mounts your current folder as ` /workspace ` |
47+ | ` -e ... ` | Passes API tokens from your host environment into the container |
48+ | ` --env-file /path/to/.env ` | Alternative to ` -e ` flags — loads vars from a file |
5049
5150To rebuild the image:
5251
5352``` bash
5453docker compose build
5554```
5655
56+ ## Two pipelines, local and server
57+
58+ The image ships two entrypoint scripts:
59+
60+ - ` local-pipeline.sh ` (default). For developers running the container against a mounted source folder. Used by
61+ ` docker compose ` and the ` docker run ` examples above. Invokes ` /configure-codacy-cloud ` against ` /workspace ` .
62+ - ` server-pipeline.sh ` . For the Active Analysis Manager (AAM) in production. Clones the repository via ` GIT_TOKEN ` ,
63+ invokes ` /configure-codacy-cloud ` , and uploads a JSONL summary to a presigned S3 URL. The clone URL is built per
64+ provider (` CODACY_PROVIDER ` of ` gh ` /` ghe ` for GitHub, ` gl ` /` gle ` for GitLab, ` bb ` for Bitbucket).
65+
66+ Both scripts run the same skill. The skill tunes a repository's Codacy Cloud configuration via Cloud reanalysis and
67+ never runs local static analysis tools — that's why the container's egress allowlist is narrow (Claude, Gemini, Codacy).
68+
69+ To test ` server-pipeline.sh ` locally, override the entrypoint and provide the additional env vars. Note that the
70+ local firewall does not allow git provider hosts, so set ` RUNNING_IN_K8S=true ` to skip it for this test:
71+
72+ ``` bash
73+ docker run --rm -it \
74+ -v codacy-tool-cache:/home/node/.codacy \
75+ -e RUNNING_IN_K8S=true \
76+ -e CODACY_API_TOKEN \
77+ -e ANTHROPIC_API_KEY \
78+ -e GIT_TOKEN \
79+ -e CODACY_PROVIDER=gh \
80+ -e CODACY_ORG_NAME=your-org \
81+ -e CODACY_REPO_NAME=your-repo \
82+ -e RESULT_UPLOAD_URL=https://httpbin.org/put \
83+ --entrypoint /usr/local/bin/server-pipeline.sh \
84+ codacy/autoconfig
85+ ```
86+
87+ ` httpbin.org/put ` accepts any PUT and is useful for smoke-testing the upload step.
88+
89+ To capture the summary on your host instead of sending it to httpbin, run a tiny HTTP sink in another terminal:
90+
91+ ``` bash
92+ python3 -c "
93+ import http.server
94+ class H(http.server.BaseHTTPRequestHandler):
95+ def do_PUT(self):
96+ n = int(self.headers.get('Content-Length', 0))
97+ open('summary.received.jsonl', 'wb').write(self.rfile.read(n))
98+ self.send_response(200); self.end_headers()
99+ http.server.HTTPServer(('0.0.0.0', 8080), H).serve_forever()
100+ "
101+ ```
102+
103+ Then point the container at it with ` RESULT_UPLOAD_URL=http://host.docker.internal:8080/upload ` .
104+
105+ Required env vars for the server pipeline: ` CODACY_API_TOKEN ` , ` ANTHROPIC_API_KEY ` , ` GIT_TOKEN ` , ` CODACY_PROVIDER ` ,
106+ ` CODACY_ORG_NAME ` , ` CODACY_REPO_NAME ` , ` RESULT_UPLOAD_URL ` . The script fails fast if any are missing.
107+
57108## What's inside
58109
59110- ` codacy ` — Codacy Cloud CLI
60- - ` codacy-analysis ` — runs static analysis tools locally (trivy, ruff, opengrep, pmd, checkov, etc., downloaded on first use )
111+ - ` codacy-analysis ` — Codacy Analysis CLI (used by the skill only for config-file operations )
61112- ` claude ` / ` gemini ` — AI assistants
62113- Java 21, Python 3.12, Ruby, Go 1.26, shellcheck
63- - Outbound firewall — allowlist only (GitHub, Codacy, Anthropic, Google, npm, PyPI)
114+ - Outbound firewall — allowlist for Claude, Gemini, and Codacy only. In production (k8s) the firewall is skipped and
115+ egress is enforced by NetworkPolicy at the cluster level instead.
0 commit comments