Live data from Hacker News

Rails on Docker

fly.io

111–120 of 228 posts

Re: Rails on Docker

#111
post #102
post #99

Earlier quoted context omitted.

How so? I just tested a build, and it used the cache for every layer including the builder layers.

You did this on the same machine, right? In a CI setting with no shared cache you need to rely on an OCI cache. The last build image is cached with the inline cache, but prior images are not

Ah, sorry I misunderstood you. Yes, I don't tend to care about whether or not the steps are cached in my CI setups as most of the Docker containers I work on build fast enough that it doesn't really matter to me, but that will of course matter for some.

Re: Rails on Docker

#112
post #86
post #42

Earlier quoted context omitted.

An terbative to removing files or go through contortions to stuff things in a single layer is to use a builder image and copy the generated artefacts into a clean image: FROM foo AS builder .. build steps FROM foo COPY --from=builder generated-file target (I hope I got that right; on a phone and been a while since I did this from scratch, but you get the overall point)

Unfortunately this messes with caching and causes the builder step to always rebuild if you’re using the default inline cache, until registries start supporting cache manifests.

A tiny bit more on this topic: https://sequoia.makes.software/reducing-docker-image-size-pa...

Re: Rails on Docker

#114

I use dokku. Works really well.

IIRC, Dokku can only manage 1 server, so it's essentially useless for anything except small side projects that don't need to scale horizontally.

Re: Rails on Docker

#115

Earlier quoted context omitted.

The answer to that is "something that is not Docker handles it". Wherever you're hosting your images there'll be something platform-specific that handles it. Azure, AWS, and GCP all have tools that'll scan and raise a notification. If you want that to trigger an automatic rebuild, the tools are there to do it. Going from there to "I don't need to think about any CVE ever" is a bit more of a policy and opinion questio…

I hadn't even thought I would be "hosting my images" on something like Azure, aWS, or GCP to deploy to fly.io. Their examples don't mention that. You just have a Dockerfile in your repo, you deploy to fly.io. But it sounds like for patch/update management purposes, now I need to add something like that in? Another platform/host to maintain/manage, at possibly additional price, and then we add dealing with the specifi…

You can run something like trivy locally, which will do that particular job. Fly.io might add that later.

It is odd, but the general direction of the market (at least at the top) is becoming less opinionated, which means you need to bring your own. Not sure I like that myself.

Re: Rails on Docker

#116
post #21

Am I the only person who struggles to deploy Rails apps. It's a super productive framework to develop in, but deploying an actuals Rails apps - after nearly 20 years of existance, still seems way more difficult than it should be. Maybe it's just me.

I've never experienced issues supporting rails deployments, and in fact find them quite easy to roll out, just as any other service written in any other language. I prefer Kubernetes though, which provides abstractions.

Re: Rails on Docker

#117
post #102
post #99

Earlier quoted context omitted.

How so? I just tested a build, and it used the cache for every layer including the builder layers.

You did this on the same machine, right? In a CI setting with no shared cache you need to rely on an OCI cache. The last build image is cached with the inline cache, but prior images are not

You can build the first stage separately as a first step using `--target` and store the cache that way. No problem.

Re: Rails on Docker

#118
post #41
post #4

I used to think I hated Docker, but I think what I actually hate is using Docker locally (building/rebuilding/cache-busting images, spinning containers up and down, the extra memory usage on macOS, etc etc). I don't need all that for development, I just want to run my dang code But I've been really enjoying it as a way of just telling a PaaS "hey here's the compiler/runtime my code needs to run", and then mostly not…

> the extra memory usage on macOS It's worth noting that the Docker experience is very different across platforms. If you just run Docker on Linux, it's basically no different than just running any other binary on the machine. On macOS and Windows, you have the overhead of a VM and its RAM to contend with at minimum , but in many cases you also have to deal with sending files over the wire or worse, mounting filesyst…

The solution I’ve settled on lately is to just run my entire dev environment inside a Linux VM anyway. This solves a handful of unrelated issues I’ve run into, but it also makes Docker a little more usable.

Re: Rails on Docker

#119
post #114

I use dokku. Works really well.

IIRC, Dokku can only manage 1 server, so it's essentially useless for anything except small side projects that don't need to scale horizontally.

Maintainer of Dokku here:

We support Kubernetes and Nomad as deployment platforms, and folks are welcome to build their own builder plugins if they need to support others.

Re: Rails on Docker

#120
I've found the "Docker for Rails Developers" book by Rob Isenberg [1] to be a great resource for getting started using Rails and Docker. It's only a couple years out of date at this point but should still be highly relevant for anyone trying to get started. The only issue I've had with Rails and Docker is serving the container on a 1gb d.o. droplet - the node-sass gem is usually a sticking point for a lot of people and believe the 1gb droplet to be just too small to host a dockerized rails app. But the benefits of using docker for Development is still overwhelmingly worth the effort of containerizing things.

It's super cool rails 7.1 is including the Dockerfile by default - not that rails apps need more boilerplate though..

[1]: https://pragprog.com/titles/ridocker/docker-for-rails-develo...

Post reply on HN