GoogleCloudPlatform / cloud-code-vscode

Cloud Code for Visual Studio Code: Issues, Documentation and more
Other
420 stars 112 forks source link

Add file sync feature for Cloud Run to allow for quicker dev cycle #539

Open willmruzek opened 2 years ago

willmruzek commented 2 years ago

Use case I'd like to utilize the server reload tools available within the container and along side the application. Usually these require a tool to watch changes in the file system.

For example, Node.JS has nodemon.

I personally plan on using a hot reloading plugin for a Clojure Pedestal app.

Feature If I'm correct, it looks like this is available for GKE dev but not Cloud Run.

An option (ala VSCode Code Cloud) that enables file sync. e.g. "sync": true

For the JVM case, I think this would be easy to achieve with Jib's sync feature.

Though, I've seen this achieved on the Dockerfile/docker-compose level as well.

Looks like Skaffold has a feature for this as well. https://skaffold.dev/docs/pipeline-stages/filesync/

glouischandra commented 2 years ago

Thanks @mruzekw for the feature request, we'll discuss with the team on this.

russwolf commented 2 years ago

FYI - we do support file sync for JVM, .NET, and Go by default if you select to build with GCP buildpacks. We'll need to explore adding extensibility to configure it for Cloud Run local dev use cases when containerizing using other methods such as Jib/Dockerfiles

willmruzek commented 2 years ago

Thanks for the tip @russwolf. I'm actually very in favor of using Buildpacks. Unfortunately I'm on an M1 Mac, and pack doesn't seem to support arm64 targets yet.

My best bet then would be to emulate an x86 architecture somehow. Haven't tried that though, so I don't know the performance implications.

The options I've thought of are:

  1. Use x86 VM
  2. Use x86 build of minikube and rely on Rosetta and Docker to take care of it.

Other than that, I'm considering using Jib or a Dockerfile.

Would appreciate any further thoughts you have here. Thanks!

briandealwis commented 2 years ago

Hi @mruzekw. You're right: creating linux/arm64 images using buildpacks isn't there yet.

The Cloud Native Buildpacks community now publishes linux/arm64 variants of the lifecycle binary that drives the build process. This means that someone could in theory provide a linux/arm64 builder image with linux/arm64 buildpacks, which would produce a linux/arm64 image (I think?). But none of the major builder providers (GCP, Heroku, and Paketo) have linux/arm64 builders, yet.

That said, linux/amd64 builders do work on M1, providing you've enable CPU emulation, though they produce a linux/amd64 image as a result. Docker Desktop comes pre-configured to use qemu as a binfmt_misc extension, and you can use tonistiigi/binfmt for other installations.

willmruzek commented 2 years ago

Thanks! Do you happen to have a guide or blog post handy for this workflow?

Sent from ProtonMail for iOS

On Tue, Mar 1, 2022 at 2:43 PM, Brian de Alwis @.***> wrote:

Hi @.***(https://github.com/mruzekw). You're right: creating linux/arm64 images using buildpacks isn't there yet.

The Cloud Native Buildpacks community now publishes linux/arm64 variants of the lifecycle binary that drives the build process. This means that someone could in theory provide a linux/arm64 builder image with linux/arm64 buildpacks, which would produce a linux/arm64 image (I think?). But none of the major builder providers (GCP, Heroku, and Paketo) have linux/arm64 builders, yet.

That said, linux/amd64 builders do work on M1, providing you've enable CPU emulation, though they produce a linux/amd64 image as a result. Docker Desktop comes pre-configured to use qemu as a binfmt_misc extension, and you can use tonistiigi/binfmt for other installations.

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>

briandealwis commented 2 years ago

@mruzekw This should just work out of the box with Cloud Code with Docker Desktop on the M1. You can see the Skaffold buildpacks example for what it might look like. If you're having problems, please open a separate issue and we can try to track it down.

I will recommend using Jib if it works for your needs as: