Ignoring Files During Application Push
When pushing applications with epinio push, you can exclude files and directories from being included in the application tarball. This feature helps reduce upload bandwidth, prevent local build artifacts from being deployed, and ensure only necessary source code is pushed to the cluster.
Overview​
The ignore feature supports gitignore-style pattern matching and can be configured in two ways:
.epinioignorefile - A file in your application directory (similar to.gitignore)epinio.yamlmanifest - Under theconfiguration.ignorefield
When both are present, patterns from both sources are merged, with .epinioignore patterns processed after manifest patterns (so they can override if needed).
Quick Start​
Using .epinioignore File​
Create a .epinioignore file in the root of your application directory:
# Create .epinioignore file
cat > .epinioignore << EOF
node_modules/
*.log
dist/
.env
EOF
Using epinio.yaml Manifest​
Add ignore patterns to your epinio.yaml:
name: myapp
configuration:
ignore:
- node_modules/
- "*.log"
- dist/
- .env
Combining Both Methods​
You can use both .epinioignore and epinio.yaml together. Patterns from .epinioignore are processed after manifest patterns, allowing file-based patterns to override manifest patterns if needed.
Pattern Syntax​
The ignore feature supports gitignore-style pattern matching with the following capabilities:
Basic Patterns​
Match files and directories by name:
node_modules/ # Matches node_modules directory
*.log # Matches all .log files
dist/ # Matches dist directory
.env # Matches .env file
Directory-Only Patterns​
Patterns ending with / match only directories:
build/ # Only matches directories named "build"
src/temp/ # Only matches directories
*.tmp/ # Only matches directories ending with .tmp
Note: A file with the same name will not be ignored if the pattern ends with /.
Wildcard Patterns​
Use * to match any characters (except path separators):
*.log # All .log files
*.tmp # All .tmp files
temp.* # Files starting with "temp."
*test* # Files containing "test"
Recursive Patterns with **​
Use ** to match any number of directories:
src/**/*.test.js # All .test.js files in src and subdirectories
**/node_modules/ # node_modules directories at any level
a/**/b/**/c # Complex nested patterns
**/*.log # All .log files at any level
Examples:
src/**/*.jsmatchessrc/file.js,src/components/file.js,src/deep/nested/file.js**/test/**matches any path containing atestdirectorya/**/b/**/cmatchesa/x/y/b/z/w/c
Root-Relative Patterns​
Patterns starting with / match only at the root of the application:
/root-only # Only matches "root-only" at the root
/subdir/ # Only matches "subdir" at the root
/config.yaml # Only matches "config.yaml" at the root
Note: Without the leading /, these patterns would match anywhere in the directory tree.
Negation Patterns​
Patterns starting with ! un-ignore files that were previously ignored:
*.log # Ignore all .log files
!important.log # But don't ignore important.log
*.tmp # Ignore all .tmp files
!critical.tmp # But don't ignore critical.tmp
Important: Negation patterns only work if the file was previously ignored by a non-negation pattern. They cannot be used to ignore files that weren't already ignored.
Comments​
Lines starting with # are treated as comments and ignored:
# This is a comment
node_modules/ # Ignore node_modules
# Another comment
*.log # Ignore log files
Common Use Cases​
Node.js/JavaScript Applications​
# .epinioignore
node_modules/
npm-debug.log
.npm
dist/
build/
.next/
.nuxt/
.cache/
*.log
.env
.env.local
.env.*.local
Python Applications​
# .epinioignore
__pycache__/
*.py[cod]
*.pyc
*.pyo
*.pyd
.Python
venv/
env/
ENV/
.venv
*.egg-info/
dist/
build/
.env
.env.local
Go Applications​
# .epinioignore
vendor/
*.exe
*.exe~
*.dll
*.so
*.dylib
*.test
*.out
.env
Build Artifacts​
# .epinioignore
dist/
build/
target/
out/
bin/
*.o
*.class
*.jar
*.war
*.ear
IDE and Editor Files​
# .epinioignore
.vscode/
.idea/
*.swp
*.swo
*~
.DS_Store
Thumbs.db
Local Configuration Files​
# .epinioignore
.env
.env.local
.env.*.local
config.local.yaml
settings.local.json
Examples​
Example 1: Simple Node.js Application​
.epinioignore:
node_modules/
dist/
*.log
.env
Result: Excludes node_modules directory, dist directory, all log files, and .env file from the push.
Example 2: Using Negation​
.epinioignore:
*.log
!important.log
*.tmp
!critical.tmp
Result: Ignores all .log and .tmp files, except important.log and critical.tmp.
Example 3: Recursive Patterns​
.epinioignore:
src/**/*.test.js
**/node_modules/
build/
Result:
- Ignores all
.test.jsfiles insrcand any subdirectories - Ignores
node_modulesdirectories at any level - Ignores
builddirectory at the root
Example 4: Root-Relative Patterns​
.epinioignore:
/root-only
/subdir/
/config.yaml
Result: Only matches these patterns at the root level. Files with the same names in subdirectories are not ignored.
Example 5: Using epinio.yaml​
epinio.yaml:
name: myapp
configuration:
ignore:
- node_modules/
- "*.log"
- dist/
- .env
Result: Same as Example 1, but configured in the manifest file.
Example 6: Combining File and Manifest​
epinio.yaml:
name: myapp
configuration:
ignore:
- build/
- "*.tmp"
.epinioignore:
node_modules/
*.log
!important.log
Result: All patterns are applied. The final ignore list includes:
build/(from manifest)*.tmp(from manifest)node_modules/(from file)*.log(from file)!important.log(from file, overrides*.logfor this file)
Best Practices​
What to Ignore​
Dependencies: node_modules/, vendor/, venv/, etc.
Build artifacts: dist/, build/, target/, compiled binaries
Local configuration: .env, .env.local, local config files
IDE/Editor files: .vscode/, .idea/, editor-specific files
Temporary files: *.log, *.tmp, *.swp
OS files: .DS_Store, Thumbs.db
What NOT to Ignore​
Source code: Your application source files
Required configuration: Production configs that need to be deployed
Dockerfiles: If you use custom Dockerfiles
Package files: package.json, requirements.txt, go.mod (unless you have a good reason)
Documentation: README, docs that should be included
Security Considerations​
Important: The ignore feature excludes files from the tarball, but this is not a security feature. Sensitive files should not be in your repository in the first place.
- Never commit secrets, API keys, or passwords to version control
- Use environment variables or secret management for sensitive data
- The ignore feature is for convenience and performance, not security
Performance Tips​
- Ignore large dependency directories (
node_modules/,vendor/) to significantly reduce upload time - Ignore build artifacts that will be regenerated during staging
- Use specific patterns rather than overly broad ones to avoid accidentally excluding needed files
How It Works​
- When you run
epinio push, Epinio collects files from your application directory - Patterns from
epinio.yaml(if present) are loaded first - Patterns from
.epinioignore(if present) are loaded and merged - Each file and directory is checked against the ignore patterns
- Ignored files are excluded from the tarball that gets uploaded
- The
.epinioignorefile itself is automatically excluded from the tarball - Git-related files (
.git,.gitignore, etc.) are always excluded regardless of patterns
Troubleshooting​
Files Are Still Being Included​
Problem: Files matching your ignore patterns are still being pushed.
Solutions:
- Verify the
.epinioignorefile is in the root of your application directory - Check for typos in pattern names
- Ensure patterns don't have leading/trailing spaces
- Remember that negation patterns (
!) only work if the file was previously ignored - Check if the file is being included via
epinio.yamlmanifest patterns
Files Are Being Excluded When They Shouldn't Be​
Problem: Files you need are being excluded.
Solutions:
- Check if a pattern is too broad (e.g.,
*matches everything) - Use negation patterns to un-ignore specific files:
!important-file.txt - Verify root-relative patterns (
/pattern) aren't matching when they shouldn't - Check both
.epinioignoreandepinio.yamlfor conflicting patterns
Pattern Not Working as Expected​
Common Issues:
- Directory vs File: Patterns ending with
/only match directories - Root-relative: Patterns starting with
/only match at the root - Recursive: Use
**for matching across multiple directory levels - Negation order: Negation patterns must come after the pattern they're negating
Verifying What's Being Ignored​
To see what files would be included/excluded, you can:
- Check the tarball (if you have access to it after creation)
- Review patterns in both
.epinioignoreandepinio.yaml - Test patterns locally using gitignore test tools (patterns are compatible)
Pattern Matching Details​
Pattern Processing Order​
- Patterns are processed in the order they appear
- Manifest patterns are processed first
- File patterns (
.epinioignore) are processed after - Later patterns can override earlier ones (especially with negation)
Matching Rules​
- Patterns are case-sensitive
- Path separators are normalized (works on both Windows and Unix)
- Unicode characters in paths are supported
- Empty lines and comments are ignored
- Patterns are matched against relative paths from the application root
Special Cases​
- The root directory (
.) is never ignored - The
.epinioignorefile itself is automatically excluded - Git files (
.git,.gitignore,.gitmodules, etc.) are always excluded - If a directory is ignored, all its contents are also ignored
Integration with epinio.yaml​
The ignore field in epinio.yaml is part of the configuration section:
name: myapp
configuration:
ignore:
- pattern1
- pattern2
- "pattern with spaces"
# Other configuration options...
instances: 2
routes:
- myapp.example.com
Note: Patterns in YAML lists should be quoted if they contain special characters or spaces.
Additional Resources​
- The ignore feature implementation follows gitignore-style pattern matching
- Patterns are compatible with
.gitignoresyntax (with some limitations) - For complex patterns, test them in a
.gitignorefile first to verify behavior
See Also​
- Application Manifests - Learn more about
epinio.yaml - epinio push - How to push applications with Epinio