git.iko.soy/typeable/octopod
on master help sign in
add the building of Docker image via Nix
commit4cdf77b3a01e57fdff738a74141fbb938359c402 authorAndrei Orlov <aaorlov1@gmail.com> dateMon 17 Feb 2020, 01:26 (7 years ago) parent1757266
3 files changed+53−2
Makefile+4−1 README.md+9−1 docker.nix+40
Makefile+4−1
@@ -1,4 +1,4 @@
1−.PHONY: build repl
1+.PHONY: build build-docker repl
22
33build: update-default-nix
44 nix-build release.nix
@@ -6,5 +6,8 @@ build: update-default-nix
66repl: update-default-nix
77 nix-shell --pure shell.nix --run "cabal repl lib:dm"
88
9+build-docker: update-default-nix
10+ nix-build --attr docker-container-slim docker.nix
11+
912update-default-nix:
1013 nix-shell --pure -p cabal2nix --run "cabal2nix ." > default.nix
README.md+9−1
@@ -1,9 +1,17 @@
11# DM
22
3−Multi-staging Deployment Manager. Consists of the client (DMC) and server (DMS) parts.
3+Multi-staging Deployment Manager (DM). MD consists of the client and server parts (DMC and DMS accordingly).
44
55# Installation
66
7+1. Install Nix
8+
9+```bash
10+curl https://nixos.org/nix/install | sh
11+```
12+
13+2. Build the project
14+
715```bash
816make build
917```
docker.nixnew file+40
@@ -0,0 +1,40 @@
1+let
2+ config = rec {
3+ packageOverrides = pkgs: rec {
4+ docker-container = pkgs.dockerTools.buildImage {
5+ name = "dms-container";
6+ config.Cmd = [ "${haskellPackages.project}/bin/dms-exe" ];
7+ };
8+
9+ docker-container-slim = pkgs.dockerTools.buildImage {
10+ name = "dms-container-slim";
11+ config.Cmd = [ "${haskellPackages.project-slim}/bin/dms-exe" ];
12+ };
13+
14+ haskellPackages = pkgs.haskellPackages.override {
15+ overrides = haskellPackagesNew: haskellPackgesOld: rec {
16+ project = pkgs.haskell.lib.overrideCabal (
17+ haskellPackagesNew.callPackage ./default.nix {}
18+ )
19+ ( oldDerivation: {}
20+ );
21+
22+ project-slim = pkgs.haskell.lib.overrideCabal (
23+ pkgs.haskell.lib.justStaticExecutables (
24+ haskellPackagesNew.callPackage ./default.nix {}
25+ )
26+ )
27+ ( oldDerivation: {}
28+ );
29+ };
30+ };
31+ };
32+
33+ };
34+
35+ pkgs = import <nixpkgs> { inherit config; system = "x86_64-linux"; };
36+in
37+ {
38+ docker-container = pkgs.docker-container;
39+ docker-container-slim = pkgs.docker-container-slim;
40+ }