Skip to content

Instantly share code, notes, and snippets.

@inariksit
Last active January 29, 2024 13:45
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 inariksit/b8545883ff3cb8b6688973c872494707 to your computer and use it in GitHub Desktop.
Save inariksit/b8545883ff3cb8b6688973c872494707 to your computer and use it in GitHub Desktop.
Dockerfile for using pgf2 library in Haskell
FROM haskell:9.2.8
RUN apt-get update \
&& apt-get install -y \
curl \
&& rm -rf /var/lib/apt/lists/*
# Install the C runtime of GF from source
WORKDIR /tmp
ARG GF_VERSION=c2182274df0a0f730b4d4a41ea4a537cdb388ecd
RUN curl https://github.com/GrammaticalFramework/gf-core/archive/$GF_VERSION.tar.gz --output gf-core.tar.gz --location && \
tar --extract --gzip --one-top-level --strip-components 1 --file gf-core.tar.gz && \
rm gf-core.tar.gz
RUN cd gf-core && cd src/runtime/c && autoreconf -i && ./configure && make && make install
# Download the tutorial repository
WORKDIR /app
RUN git clone https://github.com/inariksit/gf-embedded-grammars-tutorial.git
WORKDIR /app/gf-embedded-grammars-tutorial/advanced-pgf2
# This installs the system ghc, which comes from the haskell:9.2.8
RUN stack setup --install-ghc
# This builds the stack project
RUN stack build
# When you run the Docker container, just do stack run
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment