dockerignore

package module
v0.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 22, 2021 License: Apache-2.0 Imports: 7 Imported by: 0

README

dockerignore

Build Status PkgGoDev

A fork of Docker's package for reading and interpreting .dockerignore files

Why

Tilt watches files and live-updates containers when they change.

To do this, Tilt needs to understand container inputs (Docker contexts, dockerignores, etc.)

In the beginning, we simply used Docker as a library.

Over time, we wanted to be able to:

  • Fix bugs (for example, https://github.com/moby/moby/issues/41433)

  • Provide better debugging tools over Docker contexts (for example, to be able to tell you why a file is included or ignored)

  • Allow better optimizations (for example, being able to skip a directory that's ignored)

This library adds features and bug fixes to help.

You're welcome to use it! Ideally, we'd like to see fixes and feature here merged upstream.

License

Licensed under the Apache License, Version 2.0

Originally written by the authors of the Moby Project, https://github.com/moby/moby

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Matches

func Matches(file string, patterns []string) (bool, error)

Matches returns true if file matches any of the patterns and isn't excluded by any of the subsequent patterns.

Types

type Pattern

type Pattern struct {
	// contains filtered or unexported fields
}

Pattern defines a single regexp used to filter file paths.

func (*Pattern) Exclusion

func (p *Pattern) Exclusion() bool

Exclusion returns true if this pattern defines exclusion

func (*Pattern) String

func (p *Pattern) String() string

type PatternMatcher

type PatternMatcher struct {
	// contains filtered or unexported fields
}

PatternMatcher allows checking paths against a list of patterns

func NewPatternMatcher

func NewPatternMatcher(patterns []string) (*PatternMatcher, error)

NewPatternMatcher creates a new matcher object for specific patterns that can be used later to match against patterns against paths

func (*PatternMatcher) Exclusions

func (pm *PatternMatcher) Exclusions() bool

Exclusions returns true if any of the patterns define exclusions

func (*PatternMatcher) Matches

func (pm *PatternMatcher) Matches(file string) (bool, error)

Matches matches path against all the patterns. Matches is not safe to be called concurrently

func (*PatternMatcher) Patterns

func (pm *PatternMatcher) Patterns() []*Pattern

Patterns returns array of active patterns

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL