corysimmons
corysimmons

Reputation: 7695

Docker: How to get BrowserSync running on a CraftCMS container?

I'm new to Docker. I'm trying to use it to develop CraftCMS. I found https://hub.docker.com/r/blackpepper/craftcms which works well, but I'd really like to add BrowserSync to it (so I need NodeJS in the container as well?).

I really have no idea where to begin. I've been creating Dockerfiles and docker-compose.yml files and just throwing random stuff at it... for instance in my Dockerfile I put:

FROM blackpepper/craftcms
FROM node

RUN npm install -g browser-sync
RUN npx browser-sync start --files=templates/index.twig,web/assets/style.css --proxy=http://localhost:8080
# the proxy url is where I can actually view the craftcms site in my browser

I'd really appreciate any guidance, especially if you have experience doing something like this.

Upvotes: 0

Views: 303

Answers (1)

Vagelis Prokopiou
Vagelis Prokopiou

Reputation: 2703

After having struggled myself for years with setting up Node.js workflows including Browsersync and Gulp (or other node modules), I created an alternative that is muuch simpler to use and maintain.

I just depend on 3 binaries: inotifywait, xdotool and sassc.

If you want to know more, I have created a video showcasing the functionality. You can check it here: https://youtu.be/tMW-xQZ6c1U

Hope that helps.

Upvotes: 1

Related Questions