Skip to content

Commit

Permalink
Add Docker script to use for Linux build
Browse files Browse the repository at this point in the history
  • Loading branch information
mtolly committed Nov 23, 2020
1 parent 6d432a2 commit a494331
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 4 deletions.
3 changes: 3 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
**/.stack-work
release
test
6 changes: 6 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
FROM ubuntu:14.04
# needed for final Haskell linking
# (these are installed by stack script but we're not doing that)
RUN apt-get update && apt-get -y install g++ libgmp-dev
# needed for Stack to unpack GHC
RUN apt-get update && apt-get -y install make xz-utils
14 changes: 12 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,12 +1,22 @@
version := $(shell release/version)

.PHONY: build
.PHONY: build docker

build:
stack build
rm -rf release/${version} release/${version}.zip
mkdir release/${version}
cp $(shell stack exec which pokemid) release/${version}/
stack exec which pokemid | xargs -I{} cp {} release/${version}/
strip release/${version}/pokemid*
cp README.md release/${version}/README.txt
cd release && zip -r ${version}.zip ${version}

docker:
docker build -t onyxite/pokemid .
stack --docker --docker-image=onyxite/pokemid build
rm -rf release/${version} release/${version}.zip
mkdir release/${version}
stack --docker --docker-image=onyxite/pokemid exec which pokemid | xargs -I{} cp {} release/${version}/
strip release/${version}/pokemid*
cp README.md release/${version}/README.txt
cd release && zip -r ${version}.zip ${version}
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,9 @@ should work as well as long as you also have [GHC], [Alex], and [Happy].
[Happy]: https://www.haskell.org/happy/
[Cabal]: https://www.haskell.org/haskellwiki/Cabal-Install

`make` uses Stack to produce a release `.zip` file.
Ruby is also used to get the package version.
`make` uses Stack to produce a release `.zip` file. Ruby is also required to get
the package version. `make docker` uses Docker to build in an older Linux
distribution for higher compatibility.

## Usage

Expand Down

0 comments on commit a494331

Please sign in to comment.