Sistemazione setup Haskell + Docker

This commit is contained in:
Tito Sacchi 2023-12-28 21:50:52 +01:00
parent 17b685b93c
commit e2d4f66ee9
4 changed files with 36 additions and 0 deletions

17
Dockerfile Normal file
View File

@ -0,0 +1,17 @@
FROM haskell:9.6-slim AS haskell-builder
WORKDIR /opt/site
RUN cabal update
COPY ./Site.cabal /opt/site/Site.cabal
RUN cabal build --only-dependencies -j
COPY ./site.hs /opt/site/site.hs
RUN cabal install
RUN mv $(readlink -f /root/.cabal/bin/site) /opt/site/site
FROM debian:bookworm
WORKDIR /opt/site
RUN apt update && apt install -y texlive texlive-luatex texlive-latex-extra texlive-lang-italian latexmk curl git
RUN mkdir -p /usr/share/fonts/opentype/alegreya-sans && \
curl -fsSL -o - https://github.com/huertatipografica/Alegreya-Sans/archive/refs/tags/v2.008.tar.gz | \
tar --strip-components 3 -C /usr/share/fonts/opentype/alegreya-sans -xzf - Alegreya-Sans-2.008/fonts/otf/
COPY --from=haskell-builder /opt/site/site /opt/site/site
ENTRYPOINT ["/opt/site/site"]

2
Setup.hs Normal file
View File

@ -0,0 +1,2 @@
import Distribution.Simple
main = defaultMain

16
Site.cabal Normal file
View File

@ -0,0 +1,16 @@
name: Site
version: 1.0
synopsis: Site builder with Hakyll
author: Tito Sacchi
build-type: Simple
executable site
build-depends: hakyll >= 4.16 && < 5
, base >= 4 && < 5
, mtl >= 2 && < 3
, filepath >= 1.4 && < 2
, process >= 1.6 && < 2
, pandoc >= 3.1 && < 4
main-is: site.hs
hs-source-dirs: .
default-language: Haskell2010

View File

@ -1,6 +1,7 @@
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE OverloadedStrings #-}
import Control.Monad.State
import Control.Monad
import Hakyll
import System.FilePath
import System.Process