diff --git a/pkg/compiler/artifact.go b/pkg/compiler/artifact.go index 5a087ea1..f1f10194 100644 --- a/pkg/compiler/artifact.go +++ b/pkg/compiler/artifact.go @@ -248,7 +248,7 @@ func (a *PackageArtifact) SetPath(p string) { func (a *PackageArtifact) genDockerfile() string { return ` FROM scratch -COPY * /` +COPY . /` } // CreateArtifactForFile creates a new artifact from the given file diff --git a/pkg/compiler/artifact_test.go b/pkg/compiler/artifact_test.go index 3aad23b4..3d015532 100644 --- a/pkg/compiler/artifact_test.go +++ b/pkg/compiler/artifact_test.go @@ -175,9 +175,14 @@ RUN echo bar > /test2`)) Expect(err).ToNot(HaveOccurred()) defer os.RemoveAll(tmpWork) // clean up + Expect(os.MkdirAll(filepath.Join(tmpdir, "foo", "bar"), os.ModePerm)).ToNot(HaveOccurred()) + err = ioutil.WriteFile(filepath.Join(tmpdir, "test"), testString, 0644) Expect(err).ToNot(HaveOccurred()) + err = ioutil.WriteFile(filepath.Join(tmpdir, "foo", "bar", "test"), testString, 0644) + Expect(err).ToNot(HaveOccurred()) + artifact := NewPackageArtifact(filepath.Join(tmpWork, "fake.tar")) artifact.SetCompileSpec(&LuetCompilationSpec{Package: &pkg.DefaultPackage{Name: "foo", Version: "1.0"}}) @@ -201,6 +206,11 @@ RUN echo bar > /test2`)) Expect(err).ToNot(HaveOccurred()) Expect(content).To(Equal(testString)) + + content, err = ioutil.ReadFile(filepath.Join(result, "foo", "bar", "test")) + Expect(err).ToNot(HaveOccurred()) + + Expect(content).To(Equal(testString)) }) It("Generates empty packages images", func() {