Add docker for building

This commit is contained in:
2019-03-09 22:36:14 +03:00
parent 4be7709d9f
commit c96cc544e4
6 changed files with 53 additions and 7 deletions

37
Makefile Normal file
View File

@ -0,0 +1,37 @@
app_name := haskell-cron-matcher
image := ${app_name}-stack
container_work_dir := /app
cache_dir := ${container_work_dir}/.stack-work
uid := $(shell id -u)
gid := $(shell id -g)
stack := docker run \
--rm \
--tty \
--init \
--user "${uid}:${gid}" \
--volume "${PWD}:${container_work_dir}" \
--env "STACK_ROOT=${cache_dir}" \
--workdir "${container_work_dir}" \
${image}
# Targets
.PHONY: build-docker
build-docker:
docker build --tag=${image} .
${stack} stack --system-ghc --local-bin-path=./.local install hindent hfmt
.PHONY: build
build:
${stack} stack build
.PHONY: test
test:
${stack} stack test
.PHONY: format
format:
${stack} .local/hfmt -w src/