herokuish icon indicating copy to clipboard operation
herokuish copied to clipboard

Only copy from app import path to app path when building

Open mlandauer opened this issue 5 years ago • 7 comments

This PR fixes #402 (slug generate gzips from /tmp/app, when it should gzip from /app) and #321 (Cannot execute any Procfile commands) and fixed the issue mentioned in the blog post "Running Herokuish apps in Docker".

Currently every time herokuish is run the app import path (e.g. /tmp/app) is copied over to the app path (e.g. /app) if the import path exists and has files in it.

This PR changes this so that the copy from the import path to the app path is only done on running herokuish buildpack build or herokuish buildpack test as suggested by @matthewmueller in #402.

This means that you can now run buildpack build immediately followed by procfile start within the same container and things will work.

I can see at least two different ways that people were working around this issue before:

  1. Mount the application volume in the app directory (/app) rather than the import app directory (/tmp/app) as seen in Dokku. This has the disadvantage that build artifacts get written into the same directory as the source code (of course you might want this, you might not).
  2. By using the recommended flow as outlined by @michaelshobbs, you create a docker image from the result of running buildpack build and then running a container from that image which doesn't have a volume mounted at /tmp/app and so the contents of /app is not overwritten.

This PR should not break those workarounds.

mlandauer avatar Jul 17 '19 23:07 mlandauer

Assigning to @michaelshobbs for review :)

josegonzalez avatar Jul 18 '19 00:07 josegonzalez

@josegonzalez this should be tested with dokku before upgrading the default version

michaelshobbs avatar Jul 22 '19 17:07 michaelshobbs

@josegonzalez is there anything I can do to help with the dokku testing?

mlandauer avatar Jul 28 '19 20:07 mlandauer

@mlandauer thanks for PRing this – I'd love to see this pushed through!

matthewmueller avatar Feb 26 '20 22:02 matthewmueller

Testing in dokku would require building the herokuish image and pushing a few apps with it.

josegonzalez avatar Feb 26 '20 23:02 josegonzalez

I am pretty sure this will work based on a single test of a python app, but will try and get this more stress-tested soon.

josegonzalez avatar Mar 24 '21 15:03 josegonzalez

Any chance of this to be released in the near future? I encountered the same problem and it would be great to have this merged. This change will certainly come in handy when I want to chain multiple herokuish commands.

sriprasanna avatar Oct 20 '21 15:10 sriprasanna

This worked locally with Dokku like so:

BUILDX=false make build/docker/22 STACK_VERSION=22 && docker image tag herokuish:latest-22 gliderlabs/herokuish:latest-22 && tput bel

josegonzalez avatar Mar 28 '24 22:03 josegonzalez

Apologies for getting to this so late, just didn't have the bandwidth/mental energy to work on it.

josegonzalez avatar Mar 28 '24 22:03 josegonzalez