File tree Expand file tree Collapse file tree 14 files changed +84
-42
lines changed
cronjob-tutorial/testdata/project
getting-started/testdata/project
multiversion-tutorial/testdata/project
pkg/plugins/golang/v4/scaffolds/internal/templates Expand file tree Collapse file tree 14 files changed +84
-42
lines changed Original file line number Diff line number Diff line change 1
1
# More info: https://docs.docker.com/engine/reference/builder/#dockerignore-file
2
- # Ignore build and test binaries.
3
- bin /
2
+ # Ignore everything by default and re-include only needed files
3
+ **
4
+
5
+ # Re-include Go source files (but not *_test.go)
6
+ ! ** /* .go
7
+ ** /* _test.go
8
+
9
+ # Re-include Go module files
10
+ ! go.mod
11
+ ! go.sum
Original file line number Diff line number Diff line change @@ -11,10 +11,8 @@ COPY go.sum go.sum
11
11
# and so that source changes don't invalidate our downloaded layer
12
12
RUN go mod download
13
13
14
- # Copy the go source
15
- COPY cmd/main.go cmd/main.go
16
- COPY api/ api/
17
- COPY internal/ internal/
14
+ # Copy the Go source (relies on .dockerignore to filter)
15
+ COPY . .
18
16
19
17
# Build
20
18
# the GOARCH has no default value to allow the binary to be built according to the host where the command
Original file line number Diff line number Diff line change 1
1
# More info: https://docs.docker.com/engine/reference/builder/#dockerignore-file
2
- # Ignore build and test binaries.
3
- bin /
2
+ # Ignore everything by default and re-include only needed files
3
+ **
4
+
5
+ # Re-include Go source files (but not *_test.go)
6
+ ! ** /* .go
7
+ ** /* _test.go
8
+
9
+ # Re-include Go module files
10
+ ! go.mod
11
+ ! go.sum
Original file line number Diff line number Diff line change @@ -11,10 +11,8 @@ COPY go.sum go.sum
11
11
# and so that source changes don't invalidate our downloaded layer
12
12
RUN go mod download
13
13
14
- # Copy the go source
15
- COPY cmd/main.go cmd/main.go
16
- COPY api/ api/
17
- COPY internal/ internal/
14
+ # Copy the Go source (relies on .dockerignore to filter)
15
+ COPY . .
18
16
19
17
# Build
20
18
# the GOARCH has no default value to allow the binary to be built according to the host where the command
Original file line number Diff line number Diff line change 1
1
# More info: https://docs.docker.com/engine/reference/builder/#dockerignore-file
2
- # Ignore build and test binaries.
3
- bin /
2
+ # Ignore everything by default and re-include only needed files
3
+ **
4
+
5
+ # Re-include Go source files (but not *_test.go)
6
+ ! ** /* .go
7
+ ** /* _test.go
8
+
9
+ # Re-include Go module files
10
+ ! go.mod
11
+ ! go.sum
Original file line number Diff line number Diff line change @@ -11,10 +11,8 @@ COPY go.sum go.sum
11
11
# and so that source changes don't invalidate our downloaded layer
12
12
RUN go mod download
13
13
14
- # Copy the go source
15
- COPY cmd/main.go cmd/main.go
16
- COPY api/ api/
17
- COPY internal/ internal/
14
+ # Copy the Go source (relies on .dockerignore to filter)
15
+ COPY . .
18
16
19
17
# Build
20
18
# the GOARCH has no default value to allow the binary to be built according to the host where the command
Original file line number Diff line number Diff line change @@ -51,10 +51,8 @@ COPY go.sum go.sum
51
51
# and so that source changes don't invalidate our downloaded layer
52
52
RUN go mod download
53
53
54
- # Copy the go source
55
- COPY cmd/main.go cmd/main.go
56
- COPY api/ api/
57
- COPY internal/ internal/
54
+ # Copy the Go source (relies on .dockerignore to filter)
55
+ COPY . .
58
56
59
57
# Build
60
58
# the GOARCH has no default value to allow the binary to be built according to the host where the command
Original file line number Diff line number Diff line change @@ -39,6 +39,14 @@ func (f *DockerIgnore) SetTemplateDefaults() error {
39
39
}
40
40
41
41
const dockerignorefileTemplate = `# More info: https://docs.docker.com/engine/reference/builder/#dockerignore-file
42
- # Ignore build and test binaries.
43
- bin/
42
+ # Ignore everything by default and re-include only needed files
43
+ **
44
+
45
+ # Re-include Go source files (but not *_test.go)
46
+ !**/*.go
47
+ **/*_test.go
48
+
49
+ # Re-include Go module files
50
+ !go.mod
51
+ !go.sum
44
52
`
Original file line number Diff line number Diff line change 1
1
# More info: https://docs.docker.com/engine/reference/builder/#dockerignore-file
2
- # Ignore build and test binaries.
3
- bin /
2
+ # Ignore everything by default and re-include only needed files
3
+ **
4
+
5
+ # Re-include Go source files (but not *_test.go)
6
+ ! ** /* .go
7
+ ** /* _test.go
8
+
9
+ # Re-include Go module files
10
+ ! go.mod
11
+ ! go.sum
Original file line number Diff line number Diff line change @@ -11,10 +11,8 @@ COPY go.sum go.sum
11
11
# and so that source changes don't invalidate our downloaded layer
12
12
RUN go mod download
13
13
14
- # Copy the go source
15
- COPY cmd/main.go cmd/main.go
16
- COPY api/ api/
17
- COPY internal/ internal/
14
+ # Copy the Go source (relies on .dockerignore to filter)
15
+ COPY . .
18
16
19
17
# Build
20
18
# the GOARCH has no default value to allow the binary to be built according to the host where the command
You can’t perform that action at this time.
0 commit comments