Skip to content

Instantly share code, notes, and snippets.

@mmachenry
Created March 18, 2020 22:07
Show Gist options
  • Save mmachenry/b20c3baed66e6ddfcfea5ba05cbbeac1 to your computer and use it in GitHub Desktop.
Save mmachenry/b20c3baed66e6ddfcfea5ba05cbbeac1 to your computer and use it in GitHub Desktop.
How can I improve this Docker/Haskell build
# I like that this is very simple. Only two files, the Haskell code and the Dockerfile. But
# there are some issues that need to be addressed. They are mentioned in the comments.
FROM fpco/stack-build:lts-15.4 as haskell
WORKDIR /opt/build
COPY Main.hs /opt/build
# This reruns on every minor code change to Main.hs and takes forever
RUN stack ghc --package process -- Main.hs
# When this is scratch or alpine, I get the error: standard_init_linux.go:211: exec user process caused "no such file or directory"
FROM ubuntu:latest
COPY --from=haskell /opt/build/Main /Main
ENTRYPOINT ["/Main"]
import System.Process (readProcess)
import Control.Monad (forever)
main = forever $ do
output <- readProcess "/bin/ls" [] ""
print output
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment