Deployment slow (sending build context to docker daemon)

I’d really like to speed up my deployment to my Digital ocean droplet
The ‘sending build context to docker daemon’ takes by far the longest time.

This is taking even longer because I added more files recently (it’s 200mb+).

How can I speed this up?

Hi.
Could you check the .dockerignore file in your project? It should have node_modules and few other folders which are not needed for deploying the app.
Its very weird for a Docker image to be this big. You can add other folders here which you are using for local testing/development, but are not needed for deployment.

We also add the User Uploads Folder to dockerignore.
Since its a persistent storage folder, its files are copied only the first time you do a deployment. For all subsequent deployments, it becomes part of the Docker image, but is of no use since it does not update/re-create that folder on server.

To deploy this folder for the first time or add/remove files from it in future, I use WinSCP on Windows to connect to the prod server and manage the persistent storage folder. You can use CyberDuck if you are on Mac for the same.

1 Like

Hey Sid thanks for helping out.

Don’t think I’ve touched the .dockerignore, this is the content: image

You’re talking about the user uploads folder, this might be the cause of my issue…
But sorry I don’t fully understand you.

In my case I have an uploads/bucket folder that is used like this:

  1. User uploads file
  2. Server stores in uploads/bucket
  3. Server uploads to digitalocean
  4. Server should delete (but haven’t been diligent, some server actions don’t do that now I think)

I think this isn’t uploaded though? Isn’t this removed every time I redeploy the docker container?

EDIT: I noticed the theme I installed recently was 140MB, I cleaned it up a bit to make it 100Mb.

But to delete more things might give me extra work later in case I needed it…

Can I somehow NOT upload this folder every deploy, and instead just do it manually in case I ever update it (this might be like once a year). So I can save 100Mb being sent…

No.
If this folder is set as User Upload Folder in Wappler project settings, then it gets compiled/processed into the Docker image being deployed, but during deployment its only used only the first time. After that it is ignored.
So this is one folder you can add to .gitignore

Also, if you are uploading to DO Spaces, you can remove it from user upload folder as well. The purpose of this folder is to keep persistent data. And your plan is to delete it anyways, so.

Theme folders usually contain lots of examples and pre-compiled source code JS files. Majority of which can be just safely ignored.
As a suggestion, you should just remove the complete folder, and then just add the JS, CSS & assets that are needed to be included in the app. You can take a look at the theme's installation/usage instructions to understand what files are actually required.
Or, if its a paid theme, you can contact support for clarification.

In case you are unable to figure out which files to use - the second option is to use the User Uploads Folder.
Using WinScp or Cyberduck, log into the remote server and navigate to docker volumes folder. There you can upload the theme files directly. And then add this folder to dockerignore.
Make sure to change the theme file references used in project to this new path.

Ah thanks for the clarification, I don't have that set up.
image

Tried to go this way but this theme's installation is a bit confusing to me. It's using webpack and gulp: Automate & enhance your build workflow by KeenThemes

Either way I already removed some more files and will probably remove more soon, just a bit time consuming. Thanks :slight_smile:

That's an interesting idea, I could also opt for that.

I was trying out using the build cache Overview of best practices for writing Dockerfiles | Docker Docs to make it only send the changed file. But I couldn't get that to work. I think because it's first sending all the files over to the remote server, and THEN checking for differences and building what has changed.

and the 'sending to the remote server' part is my bottleneck (don't have great upload speeds).

Haven't used webpack and gulp before.
From the link, it says on step 8 that dist/assets is the only folder that you need.

So, keep the theme oflder outside Wappler. Do all the compliation and stuff.. make the changes to theme as needed, recomplie etc.
The final folder in dist/assets is only one that you need to include in your Wappler project.

Appreciate you helping so thoroughly.
Sadly that assets folder is the only one I included. That’s the culprit :-p

Damn. That's a really big theme then. :sweat_smile: