# COPY instruction different behavior with build server / resin cli

**URL:** <https://forums.balena.io/t/copy-instruction-different-behavior-with-build-server-resin-cli/3337>\
**Category:** Product support\
**Tags:** docker\
**Created:** [June 18, 2018, 7:48am UTC](https://forums.balena.io/t/copy-instruction-different-behavior-with-build-server-resin-cli/3337 "2018-06-18T07:48:37Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![jalim](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/jalim/32/1021_2.png) [@jalim](https://forums.balena.io/u/jalim)\
**Post date:** [June 18, 2018, 7:48am UTC](https://forums.balena.io/t/copy-instruction-different-behavior-with-build-server-resin-cli/3337/1 "2018-06-18T07:48:37Z")

</div>

Hi,

Currently I have several git submodules in my root directory, and want to copy this into the container.

The docker instruction is as the following

```
COPY dir1/src /usr/dir1/src

```

Where the submodules lie inside the /dir1/src directory.  
However, when I do `git push` to the resin app remote, the submodule directories exists, but the contents are empty.

However, when I do

```
sudo resin deploy <app_name> --build .

```

The `COPY` instructions work fine and the contents of the git submodules are copied properly.

Does this issue have something to do with the resin build server?

Thank you in advance.

---

<div class="post-metadata">

**Author:** ![dfunckt](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/dfunckt/32/56_2.png) [@dfunckt](https://forums.balena.io/u/dfunckt)\
**Post date:** [June 18, 2018, 8:44am UTC](https://forums.balena.io/t/copy-instruction-different-behavior-with-build-server-resin-cli/3337/3 "2018-06-18T08:44:17Z")

</div>

Hello @jalim, that’s because the builder doesn’t support submodules currently, so when you git push you only send the “umbrella” repository, not its submodules, so there are no files under `dir1/src`. The CLI doesn’t have any idea of git and merely builds what’s locally on the filesystem, hence you’re seeing it working fine.

---

<div class="post-metadata">

**Author:** ![jalim](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/jalim/32/1021_2.png) [@jalim](https://forums.balena.io/u/jalim)\
**Post date:** [June 19, 2018, 9:00am UTC](https://forums.balena.io/t/copy-instruction-different-behavior-with-build-server-resin-cli/3337/6 "2018-06-19T09:00:44Z")

</div>

@dfunckt Thanks, that clarifies what was happening.

If the builder doesn’t support it currently, are there any plans on supporting it?

---

<div class="post-metadata">

**Author:** ![dfunckt](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/dfunckt/32/56_2.png) [@dfunckt](https://forums.balena.io/u/dfunckt)\
**Post date:** [June 19, 2018, 9:15am UTC](https://forums.balena.io/t/copy-instruction-different-behavior-with-build-server-resin-cli/3337/7 "2018-06-19T09:15:27Z")

</div>

@jalim, the reasons submodules aren’t supported on the builder are mostly related to how git works and there are no plans that I know of to support it. That said, you can use `resin push` to replace the `git push` workflow completely. This command does support submodules and uses the builder and supports some other goodies as well.

---

<div class="post-metadata">

**Author:** ![jalim](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/jalim/32/1021_2.png) [@jalim](https://forums.balena.io/u/jalim)\
**Post date:** [June 19, 2018, 9:33am UTC](https://forums.balena.io/t/copy-instruction-different-behavior-with-build-server-resin-cli/3337/8 "2018-06-19T09:33:46Z")

</div>

@dfunckt Great thanks

---

<div class="post-metadata">

**Author:** ![jalim](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/jalim/32/1021_2.png) [@jalim](https://forums.balena.io/u/jalim)\
**Post date:** [June 19, 2018, 5:18pm UTC](https://forums.balena.io/t/copy-instruction-different-behavior-with-build-server-resin-cli/3337/9 "2018-06-19T17:18:10Z")

</div>

@dfunckt Speaking of `resin push` There are no documentation on this command and currently it stalls on

```
$ sudo resin push auterion_distro_nuc
Packaging the project source....

```

Are there any pointers for solving this issue?

---

<div class="post-metadata">

**Author:** ![CameronDiver](https://avatars.discourse-cdn.com/v4/letter/c/2acd7d/32.png) [@CameronDiver](https://forums.balena.io/u/CameronDiver)\
**Post date:** [June 19, 2018, 6:27pm UTC](https://forums.balena.io/t/copy-instruction-different-behavior-with-build-server-resin-cli/3337/10 "2018-06-19T18:27:47Z")

</div>

@jalim you would see that behaviour if your project source directory is extremely large. At that step `resin-cli` is packaging all of the files which are in your project directory into a tar archive, to upload to our build servers. How large is your project directory?

---

<div class="post-metadata">

**Author:** ![CameronDiver](https://avatars.discourse-cdn.com/v4/letter/c/2acd7d/32.png) [@CameronDiver](https://forums.balena.io/u/CameronDiver)\
**Post date:** [June 19, 2018, 6:32pm UTC](https://forums.balena.io/t/copy-instruction-different-behavior-with-build-server-resin-cli/3337/11 "2018-06-19T18:32:47Z")

</div>

Also, `sudo` is not required for `resin push`. You can access the documentation for this command with:

```auto
➜ ~ resin help push
Usage: push <application>

This command can be used to start a build on the remote
resin.io cloud builders. The given source directory will be sent to the
resin.io builder, and the build will proceed. This can be used as a drop-in
replacement for git push to deploy.

Examples:

	$ resin push myApp
	$ resin push myApp --source <source directory>
	$ resin push myApp -s <source directory>

Options:

    --source, -s <source> The source that should be sent to the resin builder to be built (defaults to the current directory)
```

---

<div class="post-metadata">

**Author:** ![jalim](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/jalim/32/1021_2.png) [@jalim](https://forums.balena.io/u/jalim)\
**Post date:** [June 20, 2018, 7:33am UTC](https://forums.balena.io/t/copy-instruction-different-behavior-with-build-server-resin-cli/3337/12 "2018-06-20T07:33:41Z")

</div>

@CameronDiver I have been trying to push my repo but for 30 minutes, it is still on the status as below.

```
Packaging the project source....

```

My source directory is 4.9MB

The behavior is quite different when I don’t initialize the git submodules in my source directory: It pushes right away

---

<div class="post-metadata">

**Author:** ![CameronDiver](https://avatars.discourse-cdn.com/v4/letter/c/2acd7d/32.png) [@CameronDiver](https://forums.balena.io/u/CameronDiver)\
**Post date:** [June 20, 2018, 9:01am UTC](https://forums.balena.io/t/copy-instruction-different-behavior-with-build-server-resin-cli/3337/13 "2018-06-20T09:01:45Z")

</div>

@jalim Is your source directory still 4.9Mb after checking out the submodules?
