Open bitspittle opened 2 years ago
(Still want to do this at some point but it's reduced priority for now because static layouts and docs are probably what people need more right now)
IMHO with the chrome dependency it is not a feasible idea to have a single base image. I would suggest splitting it into two base images a builder and a runner and use multi-stage build. You can see this in my PR https://github.com/varabyte/kobweb-site/pull/9
A slim Dockerfile could look like this.
FROM varabyte/kobweb-builder as builder
USER root
COPY . /app
WORKDIR /app
RUN kobweb export --mode dumb
FROM varabyte/kobweb-runner
USER root
COPY --from=builder /app /app
WORKDIR /app
ENV PORT=8080
EXPOSE $PORT
# Keep container running because `kobweb run --mode dumb` doesn't block
CMD kobweb run --mode dumb --env prod && tail -f /dev/null
Would it be possible to replace the kobweb export chrome with https://github.com/skrapeit/skrape.it#scrape-a-client-side-rendered-page ?
Hey, thank you so much for this comment! I'll look at your PR on Monday.
I'm honestly a Docker beginner so if you don't mind, I may reach out to you with more questions if I have them.
As an aside, I found myself getting charged by GCP way more than I expected (~$15 / month without any traffic), so I have since pivoted to using static hosting for now, and postponing server work until I am absolutely ready for it. As a result, I've personally deprioritized Docker for the moment (kobweb-site itself has been updated to use Firebase, although I left the Docker file there for possible future use). If you had an urgent usecase for Docker sooner than, say, a couple of months in the future, please let me know.
Re: the comment about replacing kobweb export chrome, I'm never against updating to a better solution. If I could remove the hard Chrome dependency I'd be ecstatic.
I checked https://docs.skrape.it/docs/dsl/extract-client-side-rendered-data and it looks like it uses Chrome itself under the hood, but emulated? To me, this either means it still requires Chrome on your system to use it, OR it has some pretty hefty dependencies that might vastly balloon the size of the kobweb Gradle plugin.
I'll create a new issue to track experimenting with this.
Edit: Created at #145
In practice, most people are using Kobweb + static layouts, which doesn't even need a custom server.
It would still be great to create a docker image for Kobweb but it might not be as high a priority as I originally intended, at a time when I assumed most people would be running their own kobweb servers.
Currently, a full docker file looks something like:
But it would be much nicer if you could just do:
with minimal fuss and it would just work