Created
November 1, 2017 00:20
-
-
Save dustin/ea787ad087ca31817fd592e001dbd5b2 to your computer and use it in GitHub Desktop.
Dockerfile for arm linux haskell build environment.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # FROM arm32v7/debian:stretch | |
| FROM resin/rpi-raspbian:stretch | |
| ENV QEMU_SET_ENV=QEMU_CPU=cortex-a9 | |
| RUN apt-get update | |
| RUN apt-get install -y netbase curl llvm-3.7 # haskell-stack | |
| RUN curl -sSL https://get.haskellstack.org/ | sh | |
| COPY stack-entry /bin/stack-entry | |
| VOLUME /root | |
| ENTRYPOINT /bin/stack-entry | |
| # ENTRYPOINT stack setup |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh -e | |
| if [ ! -d /root/.stack ] | |
| then | |
| stack setup | |
| fi | |
| exec /bin/bash |
Author
Hey, so, I would use a few things differently and maybe leverage docker-compose:
- docker-compose.yml
version: '3.1'
services:
haskell:
build: .
volumes:
- "/:/root"
stdin_open: true
tty: true
- Dockerfile
# FROM arm32v7/debian:stretch
FROM resin/rpi-raspbian:stretch
ENV QEMU_SET_ENV=QEMU_CPU=cortex-a9
RUN apt-get update
RUN apt-get install -y netbase curl llvm-3.7 # haskell-stack
RUN curl -sSL https://get.haskellstack.org/ | sh
RUN /usr/local/bin/stack setup
ENTRYPOINT [ "/bin/bash" ]
# ENTRYPOINT stack setup
- Command to run:
docker-compose up --build
That's all I needed to get the container up and running. I have the same Mac OSx as you but I have the newest stable version of docker. Make sure your docker-compose file is version '3.1' and not version '3' because I was having issues with mounting wth version '3'.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is how I build my docker environment for haskell code. (can be found at
dustin/armstackwhich is how I'll refer to it below)Setup
You'll need to specify a persistent mount point for
/rootto use this. The first time it runs, it sets up a build environment, which can take several minutes. After that,/usr/local/bin/stackis available and ready to run builds.Failure
However,
/usr/local/bin/stackdoesn't seem to work as an entry point. e.g.:fails immediately with
qemu: uncaught target signal 4 (Illegal instruction) - core dumpedWorkaround
However, the following is fine:
Test Environments
Mac
Linux