Giter Club home page Giter Club logo

Comments (2)

ComaVN avatar ComaVN commented on September 22, 2024

Note that other files in .dockerignore are properly ignored.

from skaffold.

ComaVN avatar ComaVN commented on September 22, 2024

I just noticed another difference between docker build . and skaffold build: it seems that skaffold does NOT copy the .dockerignore file, while docker build does! It's not even possible to do COPY .dockerignore . using skaffold (although I'm not sure why you'd ever want that).

$ docker build .
(...)
 > [builder 4/5] RUN ls -la ; false:                                                                                                                                                          
0.117 total 32                                                                                                                                                                                
0.117 drwxr-xr-x 1 root root 4096 May  2 12:08 .                                                                                                                                              
0.117 drwxr-xr-x 1 root root 4096 May  2 12:08 ..                                                                                                                                             
0.117 -rw-rw-r-- 1 root root   11 May  2 12:00 .dockerignore                                                                                                                                  
0.117 -rw-rw-r-- 1 root root  571 Mar 14 12:48 README.md
0.117 -rw-rw-r-- 1 root root   82 Mar 14 12:48 go.mod
0.117 -rw-rw-r-- 1 root root  133 Mar 14 12:48 k8s-pod.yaml
0.117 -rw-rw-r-- 1 root root  128 Mar 14 12:48 main.go
0.117 -rw-rw-r-- 1 root root  130 May  2 11:56 skaffold.yaml
$ skaffold build
(...)
Step 4/10 : RUN ls -la ; false
 ---> Running in 444c2c1e6f30
total 32
drwxr-xr-x 1 root root 4096 May  2 12:09 .
drwxr-xr-x 1 root root 4096 May  2 12:09 ..
-rw-rw-r-- 1 root root  470 May  2 12:05 Dockerfile
-rw-rw-r-- 1 root root  571 Mar 14 12:48 README.md
-rw-rw-r-- 1 root root   82 Mar 14 12:48 go.mod
-rw-rw-r-- 1 root root  133 Mar 14 12:48 k8s-pod.yaml
-rw-rw-r-- 1 root root  128 Mar 14 12:48 main.go
-rw-rw-r-- 1 root root  130 May  2 11:56 skaffold.yaml

Diff with getting-started example:

diff --git a/examples/getting-started/.dockerignore b/examples/getting-started/.dockerignore
new file mode 100644
index 000000000..94143827e
--- /dev/null
+++ b/examples/getting-started/.dockerignore
@@ -0,0 +1 @@
+Dockerfile
diff --git a/examples/getting-started/Dockerfile b/examples/getting-started/Dockerfile
index 67f8c3cbb..3798e28db 100644
--- a/examples/getting-started/Dockerfile
+++ b/examples/getting-started/Dockerfile
@@ -1,7 +1,7 @@
 FROM golang:1.18 as builder
 WORKDIR /code
-COPY main.go .
-COPY go.mod .
+COPY . .
+RUN ls -la ; false
 # `skaffold debug` sets SKAFFOLD_GO_GCFLAGS to disable compiler optimizations
 ARG SKAFFOLD_GO_GCFLAGS
 RUN go build -gcflags="${SKAFFOLD_GO_GCFLAGS}" -trimpath -o /app main.go

from skaffold.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.