CyCoreSystems / docker-meteor

Dockerfile and script for running Meteor on Docker
MIT License
120 stars 73 forks source link

Image always rebuilds the package #22

Closed buehler closed 8 years ago

buehler commented 8 years ago

Hey @Ulexus

I'm currently using your image and I just wanted to know the reason for rebuilding the bundle every startup. Wouldn't it be faster if you already built the application to save this state and not rebuild the whole app?

Cheers Chris

Ulexus commented 8 years ago

Yes, it is. You can supply either the source or the pre-built bundle. The bundle can be acquired by downloading a tarbar from an URL (BUNDLE_URL) or bind-mounted into place (as a directory) to /www/app (or by providing APP_DIR).

Note that even when using a prebuilt bundle, we will still run npm install to accommodate for different development and deployment architectures, but that is much faster than building from source.

buehler commented 8 years ago

Well the problem is, that I don't want to publish a bundle anywhere, I just want to build the source for the first time. I tried to use your script by my own to just use a derived image. But I kinda failed :-)

Could you give me a hint where I need to put a ".whatever" file to check for ?

Cool would be an on-build file, that builds the application and just runs it on startup so the long part would be building the image

Ulexus commented 8 years ago

Why not just bind-mount an empty /www/app volume? After the first run, the bundle should exist, and it won't have to rebuild the next time.

I dislike the on-build system, so I never use it. It might be convenient for development, but it produces horribly bloated images.

buehler commented 8 years ago

Thanks for the tipp :-) I'll look into it

smeijer commented 6 years ago

Why not just bind-mount an empty /www/app volume? After the first run, the bundle should exist, and it won't have to rebuild the next time.

Because sometimes we need to scale a container over multiple docker-hosts. As the base image is the same, so are the compiled node_modules. I'm not happy with building the same image multiple times either.

I think there should be an option where the container is building, and a ready-to-run image is being pushed to the (private) registry. Including the npm install in ./bundle/programs/server

Ulexus commented 6 years ago

I have since added a pre-bundled mode, which handles this use case (and which I use myself).

This issue was also discussed before the new layered build system of Docker exists, which is where I want to go with the concept, whenever I get the time.

Ulexus commented 6 years ago

Wrong link: this is what I use.

smeijer commented 6 years ago

When the container is run, the Meteor tool will NOT be downloaded. Instead, npm install will be run to resolve any dependencies for the server, and your application will be run directly with NodeJS.

I also wish to bypass the npm install on the server itself. I have found that https://github.com/jshimko/meteor-launchpad can help me with that :)