Skip to content

Commit 7876a1f

Browse files
committed
perf(common): add root .dockerignore to reduce build context size
Add a root .dockerignore file to exclude unnecessary files from Docker build context when using repo root as the build context (used by test-suite compose files). Key exclusions: - **/target/ - Rust build artifacts (can be GB-scale) - **/fhevm-keys/ - FHE key files (can be GB-scale) - **/node_modules/ - Node.js dependencies - docs/, charts/, *.pdf, *.md - Documentation - IDE/OS files, test artifacts, logs, Python cache - CI/CD config files not needed for builds - protocol-contracts/, sdk/, golden-container-images/, ci/ All Dockerfile COPY paths are preserved: - coprocessor/fhevm-engine/, coprocessor/proto/ - gateway-contracts/, kms-connector/ - host-contracts/, library-solidity/, test-suite/ - .git/ (needed for build metadata) - package.json, package-lock.json Build context reduction: ~2.53 GB → ~26 MB (99% reduction) Closes #837
1 parent a578e9a commit 7876a1f

File tree

1 file changed

+139
-0
lines changed

1 file changed

+139
-0
lines changed

.dockerignore

Lines changed: 139 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
# =============================================================================
2+
# Root .dockerignore for fhevm repository
3+
# =============================================================================
4+
# This file reduces Docker build context size when builds use the repo root as
5+
# context (e.g., test-suite/fhevm/docker-compose/*.yml files).
6+
#
7+
# IMPORTANT: Do not exclude paths that Dockerfiles COPY from:
8+
# - coprocessor/fhevm-engine/
9+
# - coprocessor/proto/
10+
# - gateway-contracts/
11+
# - kms-connector/
12+
# - host-contracts/
13+
# - library-solidity/
14+
# - test-suite/
15+
# - package.json, package-lock.json
16+
# - .git/ (used for build metadata in some Dockerfiles)
17+
# =============================================================================
18+
19+
# -----------------------------------------------------------------------------
20+
# Rust build artifacts (CRITICAL - can be GB-scale)
21+
# -----------------------------------------------------------------------------
22+
**/target/
23+
24+
# -----------------------------------------------------------------------------
25+
# FHE keys (CRITICAL - can be GB-scale, mounted at runtime)
26+
# -----------------------------------------------------------------------------
27+
**/fhevm-keys/
28+
**/*.fhekey
29+
30+
# -----------------------------------------------------------------------------
31+
# Node.js dependencies and build artifacts
32+
# -----------------------------------------------------------------------------
33+
**/node_modules/
34+
**/dist/
35+
**/.next/
36+
**/.turbo/
37+
**/.cache/
38+
39+
# -----------------------------------------------------------------------------
40+
# IDE and OS files
41+
# -----------------------------------------------------------------------------
42+
.idea/
43+
.vscode/
44+
*.swp
45+
*.swo
46+
*~
47+
.DS_Store
48+
Thumbs.db
49+
50+
# -----------------------------------------------------------------------------
51+
# Test artifacts and coverage
52+
# -----------------------------------------------------------------------------
53+
**/coverage/
54+
**/.nyc_output/
55+
**/junit.xml
56+
**/*.lcov
57+
58+
# -----------------------------------------------------------------------------
59+
# Logs
60+
# -----------------------------------------------------------------------------
61+
**/*.log
62+
**/npm-debug.log*
63+
**/yarn-debug.log*
64+
**/yarn-error.log*
65+
66+
# -----------------------------------------------------------------------------
67+
# Documentation (not needed for builds)
68+
# Large PDF files and markdown docs that aren't required by Dockerfiles
69+
# -----------------------------------------------------------------------------
70+
docs/
71+
charts/
72+
*.pdf
73+
**/*.md
74+
!**/README.md
75+
76+
# Re-include README.md files since some tooling might expect them
77+
# (though they're generally not needed for Docker builds)
78+
79+
# -----------------------------------------------------------------------------
80+
# Python artifacts
81+
# -----------------------------------------------------------------------------
82+
**/__pycache__/
83+
**/*.pyc
84+
**/*.pyo
85+
**/.venv/
86+
**/venv/
87+
**/.pytest_cache/
88+
89+
# -----------------------------------------------------------------------------
90+
# Environment files with secrets (local overrides are gitignored)
91+
# Keep base .env.* templates as they're tracked in git
92+
# -----------------------------------------------------------------------------
93+
**/.env
94+
**/.env.local
95+
**/.env.*.local
96+
97+
# -----------------------------------------------------------------------------
98+
# Git-related (keep .git/ for build metadata, exclude others)
99+
# -----------------------------------------------------------------------------
100+
.gitignore
101+
.gitattributes
102+
**/.gitkeep
103+
104+
# -----------------------------------------------------------------------------
105+
# CI/CD and config files not needed in builds
106+
# -----------------------------------------------------------------------------
107+
.github/
108+
.devcontainer/
109+
.mergify.yml
110+
.commitlintrc.json
111+
.hadolint.yaml
112+
.linkspector.yml
113+
.prettierrc.yml
114+
.prettierignore
115+
.slither.config.json
116+
.npmrc
117+
CODE_OF_CONDUCT.md
118+
LICENSE
119+
SECURITY.md
120+
121+
# -----------------------------------------------------------------------------
122+
# Golden container images (base image definitions, not needed in app builds)
123+
# -----------------------------------------------------------------------------
124+
golden-container-images/
125+
126+
# -----------------------------------------------------------------------------
127+
# SDK (not used by any Dockerfile)
128+
# -----------------------------------------------------------------------------
129+
sdk/
130+
131+
# -----------------------------------------------------------------------------
132+
# Protocol contracts (not used by any Dockerfile)
133+
# -----------------------------------------------------------------------------
134+
protocol-contracts/
135+
136+
# -----------------------------------------------------------------------------
137+
# CI directory (not used by any Dockerfile)
138+
# -----------------------------------------------------------------------------
139+
ci/

0 commit comments

Comments
 (0)