How to setup Docker - on existing project

Trying to follow the instructions from George on the topic: Ultra fast web development with Docker in Wappler

But hitting this error below.

Step 4/5 : COPY package.json .
ERROR: Service ‘web’ failed to build: COPY failed: stat /var/lib/docker/tmp/docker-builder229744397/package.json: no such file or directory
Error Launching Services!

Docker is running in the background. Is there something more I need to configure?

View this video from Brian English:

Thanks Ben, I watched the video and have followed the instructions for Mac. The specific error that I’m getting when trying to deploy is :

COPY failed: stat /var/lib/docker/tmp/docker-builder229744397/package.json: no such file or directory

So the question is…do I need to create this package.json on that path? If yes, then what do I put in there or how do I create it?

How is your project folder structure setup? Do you have a package.json in your root?

Did you just create a new project and choose directly NodeJS and docker? (As you should)
Or set them afterwards (won’t work)

1 Like

Thanks a lot George, I created a new project which is what I needed to. And it worked! This makes it so easy for a non-dev like me.

I was trying this out first on the default projects that are pre-loaded. Wasn’t aware it wouldn’t work there.

2 Likes

Yes as the project structure depends on the choices you make for server model - it is best to choose right with a new project.

You can’t just change the server model of existing projects, we should indeed warn about that and prohibit the change

2 Likes

@George based on this, should I assume if I initially setup a project on Heroku, I can’t then change this to a different hosting provider? I’d need to then create a new project with ‘custom host’ for example, clone all files from the old project and then upload to a new host? Trying to find an appropriate cloud host that will also support the current upload functionality, in absence of AWS S3 connect.

No, you should be able to just create a new target with the hosting details

3 Likes

You can define your hosting per target, it doesn’t matter.

You just have to use the same server model.

And some hosting like Firebase support only static HTML files.

1 Like

Ok, thank you @George - still learning the intricacies. So currently the app is on NodeJS, if I wanted to utilize Docker - what would the process be? Create a new project with nodejs + docker, then manually copy/paste all the file structure from the old project? (I would assume that wouldn’t work!).

I think all you would need to do is create a new target with your existing project. No need to start a new one (and if you did, i’d clone from GIT rather than copy paste etc)

2 Likes

Yes in with NodeJS project you can just switch to docker in the target settings of an existing project. No need to start again with new project.

Further question @George I’ve been playing with Docker today on an existing project for the first time, and it was easy to deploy and get set up (I had to switch to Linux Containers like i found in other posts).

But one thing i can’t figure out is how to ‘migrate’ the database structure/data from your existing remote database connection into the Docker database connection?

In my case, and possible @mgaussie, we already have the project set up and a working remote DB connection. When i create a new Docker target the database is empty (or has sample data).

Should i be re-creating the db scheme in Wappler? Or should i connect remotely to docker DB through Navicat and import the existing DB schema.

What are your thoughts?

If you have a remote database server already then you don’t have to use the one from docker, so just choose none there and keep using the existing as you do.

Ok… hadn’t thought of it that way. I’ll look into it.

I realise though, if i had built the DB from scratch in the new DB manager it would easily have migrated between targets just by applying the changes right?

Thanks to @George and everyone in this thread that contributed. Just got our first Docker Project rolling for deployment to AWS using Node JS. So a lot of firsts for us, and we imagine a lot of questions on the way! All in all took about an hour to set-up on Windows 10. Including the downloads and installations of Docker, WSL, Kernel update, ISO file, and of course Wappler Project creation. Quite pleasant experience and already learning new things. Am pretty adapt with *nix so that part doesn’t daunt me at all… All very interesting and exciting!

Thank you!

:slight_smile:

Something that might help others with WSL (on Windows) mad memory usage! Machine sounded like a wind tunnel, even my wife came in to see if I had turned AC on hahaha… Turned out the VM process VMMEM was consuming more memory than an expat consumes white wine here in sunny Portugal!

Found this on the MS Docs:

Simply create:

.wslconfig

In:

C:\Users\YOURUSERNAME

And add (set memory to a limit your machine can tolerate):

 [wsl2]
memory=4GB
swap=0
processors=4

Save the file, restart Docker… No wind tunnel!

:smiley: