Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion dockerclient/archive.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ func archiveFromURL(src, dst, tempDir string, check DirectoryCheck) (io.Reader,
func archiveFromDisk(directory string, src, dst string, allowDownload bool, excludes []string, check DirectoryCheck) (io.Reader, io.Closer, error) {
var err error
if filepath.IsAbs(src) {
src, err = filepath.Rel(filepath.Dir(src), src)
src, err = filepath.Rel(directory, filepath.Join(directory, src))
if err != nil {
return nil, nil, err
}
Expand Down
15 changes: 15 additions & 0 deletions dockerclient/conformance_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,21 @@ func TestConformanceInternal(t *testing.T) {
Name: "copy to renamed file",
ContextDir: "testdata/copyrename",
},
{
Name: "copy subdirectory 1",
ContextDir: "testdata/copyblahblub",
Dockerfile: "Dockerfile",
},
{
Name: "copy subdirectory 2",
ContextDir: "testdata/copyblahblub",
Dockerfile: "Dockerfile2",
},
{
Name: "copy subdirectory 3",
ContextDir: "testdata/copyblahblub",
Dockerfile: "Dockerfile3",
},
{
Name: "directory with slash",
ContextDir: "testdata/overlapdir",
Expand Down
4 changes: 4 additions & 0 deletions dockerclient/testdata/copyblahblub/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
FROM busybox
COPY firstdir/seconddir /var
RUN ls -la /var
RUN ls -la /var/dir-a
4 changes: 4 additions & 0 deletions dockerclient/testdata/copyblahblub/Dockerfile2
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
FROM busybox
COPY /firstdir/seconddir /var
RUN ls -la /var
RUN ls -la /var/dir-a
4 changes: 4 additions & 0 deletions dockerclient/testdata/copyblahblub/Dockerfile3
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
FROM busybox
COPY /firstdir/seconddir/ /var
RUN ls -la /var
RUN ls -la /var/dir-a
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
file-a
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
file-b