Dockerfile additional commands

I found that with each Wappler update Dockerfile rewrites. I have a few additional lines in Dockerfile so it’s quite annoying to re-write them with each update.

Can we have section some where in Wappler for docker based projects where we can type in our custom lines?

I keep finding the same issue with my Puppeteer code in my dockerfile. You’ve got my vote.

It’s the same issue as with Bootstrap in the past. i understand they want to keep control over the standard dockerfile.

Another solution would be to allow custom dockerfiles to be selected from the UI for targets.

We actually don’t rewrite docker-compose files. We just add/update only our own settings in them.

So all other settings are left alone.

Maybe something else is going on?

1 Like

Could you please describe a bit more on “We just add/update only our own settings in them”.
This is my Docker file

FROM wapplerio/node-14

ENV NODE_ENV development
WORKDIR /opt/node_app
COPY package.json .
RUN npm install --no-optional
RUN apt-get update && apt-get install -y iputils-ping
CMD [ "nodemon", "--legacy-watch", "./index.js" ]

In the middle of the file I’ve added RUN apt-get update && apt-get install -y iputils-ping and this line is lost after each Wappler update. Maybe I should add this line in the end of docker file?

From my experience, if you go into project target settings and save them, only at that point the Dockerfile gets restored to Wappler version. This also happens to the .dockerignore file.
Maybe thats something you might want to fix @George?

Updating Wappler does not update anything docker related.

Can’t emphasis enough, use GIT. If you already are, keep an eye on what changes are shown - you will see exactly what gets updated when you update Wappler & when you save project settings.

“if you go into project target settings and save them, only at that point the Dockerfile gets restored to Wappler version.” - you’re totally right @sid - just checked this.
Maybe it was coincidence that I’m visiting Target Setting after each Wappler update.

Anyhow - this behavior should be changed/improved.

Sorry I was talking about the docker-compose.yml files where all services are defined.

Those are the files you can add additional services and we do not overwrite them.

You should really not have to change the core Dockerfile that we provide as we rely on that and you can easily break everything.

In Docker world - if you need additional services - you just add them to the docker-compose as separate services and do not put multiple things in one.

It is all about separation of concerns.

I get it but may I ask - what would be a best approach to add this command RUN apt-get update && apt-get install -y iputils-ping in docker-compose.yml for web-service? As I found - it’s impossible to have several docker file defined for 1 service.

Why do you need this command in your node server in first place?

Web server gonna ping other machines in local network in order to build monitoring status page.
I mean - there might be plenty of commands that you might use in your docker (obvously not only my case). That’s why I’m asking for such feature: Add option in Wappler to add any additional commands inside docker file so that when Wappler re-writes dockerfile your custom commands won’t disappear but written with Wappler instead.

EXAMPLE: For the HTML to PDF extension that we built, we need to add a set of commands to Dockerfile to ensure Puppeteer & Chromium gets installed correctly.
You can take a look at the example in my post here: HTML to PDF Action - NodeJS & PHP [Open Source]

We do this in at least 4 of our projects. With GIT, we are able to easily discard changes made to dockerfile & .dockerignore when updating target settings.
Although, its very rare that we tinker in the target settings of a project… so it has never been a big issue for us.

Thanks Sid,

I understand the problem now. Indeed sometimes you need additional server components to be installed.

Maybe we should add to the Docker target options a simple list of additional commands you want to get executed on install. So that those just get added in the Dockerfile as RUN commands.

7 Likes

Yes, that would be a good Visual Wappler way. :slightly_smiling_face:

Just as @sid, I also use the Puppeteer install in my Dockerfile.
As a band-aid solution, I’ve added an alternate dockerfile and pointed docker-compose to use this dockerfile instead.

Hey guys…did this ever happen? Sure would be nice.

Bumping the request as a reminder!

:slight_smile:

Being a year late maybe this request has already been implemented? Am we OK to make additions to the Dockerfile located in the .wappler directory within the project?

?