├── .gitignore ├── LICENSE ├── Makefile ├── README.md └── example ├── .gitignore ├── Dockerfile ├── Makefile └── hello.hs /.gitignore: -------------------------------------------------------------------------------- 1 | /root/ 2 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Michael Snoyman 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | default: docker-integer-gmp docker-integer-simple 2 | 3 | root: 4 | @mkdir root 5 | root/bin: | root 6 | @mkdir root/bin 7 | root/etc: | root 8 | @mkdir root/etc 9 | root/bin/sh: | root/bin 10 | @cp -L /bin/sh root/bin/ 11 | root/lib: | root 12 | @mkdir root/lib 13 | root/lib/x86_64-linux-gnu: | root/lib 14 | @mkdir root/lib/x86_64-linux-gnu 15 | root/lib/x86_64-linux-gnu/libc.so.6: | root/lib/x86_64-linux-gnu 16 | @cp -L /lib/x86_64-linux-gnu/libc.so.6 root/lib/x86_64-linux-gnu/ 17 | root/lib/x86_64-linux-gnu/libdl.so.2: | root/lib/x86_64-linux-gnu 18 | @cp -L /lib/x86_64-linux-gnu/libdl.so.2 root/lib/x86_64-linux-gnu/ 19 | root/lib/x86_64-linux-gnu/libm.so.6: | root/lib/x86_64-linux-gnu 20 | @cp -L /lib/x86_64-linux-gnu/libm.so.6 root/lib/x86_64-linux-gnu/ 21 | root/lib/x86_64-linux-gnu/libpthread.so.0: | root/lib/x86_64-linux-gnu 22 | @cp -L /lib/x86_64-linux-gnu/libpthread.so.0 root/lib/x86_64-linux-gnu/ 23 | root/lib/x86_64-linux-gnu/libutil.so.1: | root/lib/x86_64-linux-gnu 24 | @cp -L /lib/x86_64-linux-gnu/libutil.so.1 root/lib/x86_64-linux-gnu/ 25 | root/lib/x86_64-linux-gnu/librt.so.1: | root/lib/x86_64-linux-gnu 26 | @cp -L /lib/x86_64-linux-gnu/librt.so.1 root/lib/x86_64-linux-gnu/ 27 | root/lib/x86_64-linux-gnu/libz.so.1: | root/lib/x86_64-linux-gnu 28 | @cp -L /lib/x86_64-linux-gnu/libz.so.1 root/lib/x86_64-linux-gnu/ 29 | root/lib/x86_64-linux-gnu/libnss_files.so.2: | root/lib/x86_64-linux-gnu 30 | @cp -L /lib/x86_64-linux-gnu/libnss_files.so.2 root/lib/x86_64-linux-gnu/ 31 | root/lib/x86_64-linux-gnu/libnss_dns.so.2: | root/lib/x86_64-linux-gnu 32 | @cp -L /lib/x86_64-linux-gnu/libnss_dns.so.2 root/lib/x86_64-linux-gnu/ 33 | root/lib/x86_64-linux-gnu/libresolv.so.2: | root/lib/x86_64-linux-gnu 34 | @cp -L /lib/x86_64-linux-gnu/libresolv.so.2 root/lib/x86_64-linux-gnu/ 35 | root/lib64: | root 36 | @mkdir root/lib64 37 | root/lib64/ld-linux-x86-64.so.2: | root/lib64 38 | @cp -L /lib64/ld-linux-x86-64.so.2 root/lib64/ 39 | root/etc/protocols: | root/etc 40 | @cp -L /etc/protocols root/etc/ 41 | root/etc/services: | root/etc 42 | @cp -L /etc/services root/etc/ 43 | root/usr: | root 44 | @mkdir root/usr 45 | root/usr/lib: | root/usr 46 | @mkdir root/usr/lib 47 | root/usr/lib/x86_64-linux-gnu: | root/usr/lib 48 | @mkdir root/usr/lib/x86_64-linux-gnu 49 | root/usr/lib/x86_64-linux-gnu/gconv: | root/usr/lib/x86_64-linux-gnu 50 | @mkdir root/usr/lib/x86_64-linux-gnu/gconv 51 | root/usr/lib/x86_64-linux-gnu/gconv/UTF-16.so: | root/usr/lib/x86_64-linux-gnu/gconv 52 | @cp -L /usr/lib/x86_64-linux-gnu/gconv/UTF-16.so root/usr/lib/x86_64-linux-gnu/gconv/ 53 | root/usr/lib/x86_64-linux-gnu/gconv/UTF-32.so: | root/usr/lib/x86_64-linux-gnu/gconv 54 | @cp -L /usr/lib/x86_64-linux-gnu/gconv/UTF-32.so root/usr/lib/x86_64-linux-gnu/gconv/ 55 | root/usr/lib/x86_64-linux-gnu/gconv/UTF-7.so: | root/usr/lib/x86_64-linux-gnu/gconv 56 | @cp -L /usr/lib/x86_64-linux-gnu/gconv/UTF-7.so root/usr/lib/x86_64-linux-gnu/gconv/ 57 | root/usr/lib/x86_64-linux-gnu/gconv/gconv-modules: | root/usr/lib/x86_64-linux-gnu/gconv 58 | @cp -L /usr/lib/x86_64-linux-gnu/gconv/gconv-modules root/usr/lib/x86_64-linux-gnu/gconv/ 59 | root/usr/lib/x86_64-linux-gnu/gconv/gconv-modules.cache: | root/usr/lib/x86_64-linux-gnu/gconv/ 60 | @cp -L /usr/lib/x86_64-linux-gnu/gconv/gconv-modules.cache root/usr/lib/x86_64-linux-gnu/gconv/ 61 | root/usr/lib/x86_64-linux-gnu/libgmp.so.10: | root/usr/lib/x86_64-linux-gnu 62 | @cp -L /usr/lib/x86_64-linux-gnu/libgmp.so.10 root/usr/lib/x86_64-linux-gnu/ 63 | 64 | integer-gmp: | root/bin/sh root/lib/x86_64-linux-gnu/libc.so.6 root/lib/x86_64-linux-gnu/libdl.so.2 root/lib/x86_64-linux-gnu/libm.so.6 root/lib/x86_64-linux-gnu/libpthread.so.0 root/lib/x86_64-linux-gnu/librt.so.1 root/lib/x86_64-linux-gnu/libutil.so.1 root/lib/x86_64-linux-gnu/libz.so.1 root/lib64/ld-linux-x86-64.so.2 root/usr/lib/x86_64-linux-gnu/gconv/UTF-16.so root/usr/lib/x86_64-linux-gnu/gconv/UTF-32.so root/usr/lib/x86_64-linux-gnu/gconv/UTF-7.so root/usr/lib/x86_64-linux-gnu/gconv/gconv-modules root/usr/lib/x86_64-linux-gnu/gconv/gconv-modules.cache root/usr/lib/x86_64-linux-gnu/libgmp.so.10 root/lib/x86_64-linux-gnu/libnss_files.so.2 root/lib/x86_64-linux-gnu/libnss_dns.so.2 root/lib/x86_64-linux-gnu/libresolv.so.2 root/etc/protocols root/etc/services 65 | 66 | integer-simple: | root/bin/sh root/lib/x86_64-linux-gnu/libc.so.6 root/lib/x86_64-linux-gnu/libdl.so.2 root/lib/x86_64-linux-gnu/libm.so.6 root/lib/x86_64-linux-gnu/libpthread.so.0 root/lib/x86_64-linux-gnu/librt.so.1 root/lib/x86_64-linux-gnu/libutil.so.1 root/lib/x86_64-linux-gnu/libz.so.1 root/lib64/ld-linux-x86-64.so.2 root/usr/lib/x86_64-linux-gnu/gconv/UTF-16.so root/usr/lib/x86_64-linux-gnu/gconv/UTF-32.so root/usr/lib/x86_64-linux-gnu/gconv/UTF-7.so root/usr/lib/x86_64-linux-gnu/gconv/gconv-modules root/usr/lib/x86_64-linux-gnu/gconv/gconv-modules.cache root/lib/x86_64-linux-gnu/libnss_files.so.2 root/lib/x86_64-linux-gnu/libnss_dns.so.2 root/lib/x86_64-linux-gnu/libresolv.so.2 root/etc/protocols root/etc/services 67 | 68 | docker-integer-gmp: | integer-gmp 69 | @tar -cC root .|docker import - haskell-scratch:integer-gmp 70 | 71 | docker-integer-simple: | integer-simple 72 | @tar -c --exclude=libgmp.so.10 -C root .|docker import - haskell-scratch:integer-simple 73 | 74 | clean: 75 | @rm -rf root 76 | 77 | push: 78 | @docker tag -f haskell-scratch:integer-gmp fpco/haskell-scratch:integer-gmp 79 | @docker push fpco/haskell-scratch:integer-gmp 80 | @docker tag -f haskell-scratch:integer-simple fpco/haskell-scratch:integer-simple 81 | @docker push fpco/haskell-scratch:integer-simple 82 | @docker tag -f haskell-scratch:integer-simple fpco/haskell-scratch:latest 83 | @docker push fpco/haskell-scratch:latest 84 | 85 | .PHONY: default docker-integer-gmp docker-integer-simple clean push 86 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # haskell-scratch 2 | 3 | Base Docker image which includes minimal shared libraries for GHC-compiled executables. 4 | For more information, see [Haskell Web Server in a 5MB Docker Image](https://www.fpcomplete.com/blog/2015/05/haskell-web-server-in-5mb). 5 | 6 | __NOTE__: Many people have sent pull requests to increase the scope of this image. 7 | While changes will almost certainly be necessary to this image for most real-world 8 | applications, adding them to the base image defeats its purpose as an example of 9 | a minimalistic scratch image. Such additional features should rather go in 10 | separate images. Consider the requirements of this image to be able to successfully 11 | run a "hello world" GHC statically-compiled application. 12 | -------------------------------------------------------------------------------- /example/.gitignore: -------------------------------------------------------------------------------- 1 | *.hi 2 | *.o 3 | hello 4 | -------------------------------------------------------------------------------- /example/Dockerfile: -------------------------------------------------------------------------------- 1 | #-*- mode:conf; -*- 2 | 3 | FROM fpco/haskell-scratch:integer-gmp 4 | 5 | ADD hello /usr/bin/hello 6 | CMD hello 7 | -------------------------------------------------------------------------------- /example/Makefile: -------------------------------------------------------------------------------- 1 | default: run 2 | 3 | hello: 4 | @ghc hello.hs 5 | @strip hello 6 | 7 | image: | hello 8 | @docker build -t haskell-scratch:hello . 9 | 10 | run: | image 11 | @docker run --rm --name hello -i -t haskell-scratch:hello 12 | 13 | clean: 14 | @rm -rf hello 15 | 16 | .PHONY: default image run 17 | -------------------------------------------------------------------------------- /example/hello.hs: -------------------------------------------------------------------------------- 1 | main = putStrLn "Hello World" 2 | --------------------------------------------------------------------------------