Skip to content

Instantly share code, notes, and snippets.

@tfausak
Last active January 27, 2023 15:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tfausak/1aab1287aa78c99ed55fd14d7cbcef25 to your computer and use it in GitHub Desktop.
Save tfausak/1aab1287aa78c99ed55fd14d7cbcef25 to your computer and use it in GitHub Desktop.
FROM debian:stable-slim as build
RUN apt-get update && apt-get install --assume-yes \
gcc \
libgmp-dev \
make \
wget \
xz-utils \
zlib1g-dev
WORKDIR /root/stack
RUN wget https://github.com/commercialhaskell/stack/releases/download/v1.5.1/stack-1.5.1-linux-x86_64-static.tar.gz
RUN tar --extract --file stack-*-linux-x86_64-static.tar.gz
RUN cp stack-*-linux-x86_64-static/stack /usr/local/bin
WORKDIR /root/project
COPY stack.yaml .
RUN stack setup
COPY package.yaml .
RUN stack build --only-dependencies
COPY . .
RUN stack install --ghc-options -optl-static
FROM scratch
COPY --from=build /root/.local/bin/example /
ENV PORT 80
EXPOSE $PORT
CMD ["/example"]
import qualified Data.Text as Text
import qualified Data.Text.IO as Text
main :: IO ()
main = Text.putStrLn (Text.pack "Hello, world!")
name: example
version: 1.0.0
executables:
example:
main: example.hs
dependencies: [base, text]
resolver: lts-9.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment