Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"stack image container" do not copy the data files #3590

Closed
Qinka opened this issue Nov 19, 2017 · 3 comments
Closed

"stack image container" do not copy the data files #3590

Qinka opened this issue Nov 19, 2017 · 3 comments

Comments

@Qinka
Copy link

Qinka commented Nov 19, 2017

The stack image container command do not copy the data files.

I use stack image container to try to build a docker image.
But stack only copy the binary without datafile.

For example:
My stack.yaml includes:

image:
  containers:
    - name: 'test'
      base: debian

Then I run stack image container.

After the image built, I run docker run -it test, and run my app in container.
But I get:

root@81d31e691b57:/usr/local# fluffy  300 port=10
/home/qinka/fluffy-engine/.stack-work/install/x86_64-linux-nopie/nightly-2017-11-13/8.2.1/share/x86_64-linux-ghc-8.2.1/fluffy-0.1.0.0
fluffy: /home/qinka/fluffy-engine/.stack-work/install/x86_64-linux-nopie/nightly-2017-11-13/8.2.1/share/x86_64-linux-ghc-8.2.1/fluffy-0.1.0.0: getDirectoryContents:openDirStream: does not exist (No such file or directory)

(And the data files are not copied to the right location)

@mgsloan
Copy link
Contributor

mgsloan commented Nov 21, 2017

Hmm, this is related to the problem of supporting uninstallation, these are hard for the same reason - see #361.

Could potentially copy all files in the resulting bin dir, instead of being selective. May be feasible to handle stuff that's properly declared via data-files in the cabal file. Not sure if that'd cover your case.

How about writing a script that builds a docker image that contains the data files, based on the results of stack image container? I realize that's a bit inconvenient, but unfortunately stack does not always have the requisite info to locate data files. Handling it at least for data-files would be nice, though.

@mgsloan mgsloan added this to the P2: Should milestone Nov 21, 2017
@borsboom
Copy link
Contributor

Also potentially related to supporting --prefix (#848), since otherwise the data files would need to be in exactly the same filesystem location in the image as it was built on the host.

@snoyberg
Copy link
Contributor

snoyberg commented Apr 8, 2019

For Stack 2.0, we're removing this command entirely. Instead, we're recommending multistage Docker files, see https://www.fpcomplete.com/blog/2017/12/building-haskell-apps-with-docker

@snoyberg snoyberg closed this as completed Apr 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants