Add simple Docker build for project
This commit is contained in:
parent
8f8565e07d
commit
7093aa4c9c
2 changed files with 24 additions and 0 deletions
23
docker.nix
Normal file
23
docker.nix
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
let
|
||||||
|
pkgs = import <nixpkgs> { };
|
||||||
|
compiler-project = import ./default.nix { rustPlatform = pkgs.rustPlatform; };
|
||||||
|
source-code = builtins.fetchGit {
|
||||||
|
url = "https://gitea.vsinerva.fi/VSinerva/compiler-course.git";
|
||||||
|
name = "compiler-course-src";
|
||||||
|
ref = "main";
|
||||||
|
};
|
||||||
|
in
|
||||||
|
pkgs.dockerTools.buildImage {
|
||||||
|
name = "compiler-course-docker";
|
||||||
|
copyToRoot = pkgs.buildEnv {
|
||||||
|
name = "project-source";
|
||||||
|
paths = [ source-code ];
|
||||||
|
extraPrefix = "/Project_Source";
|
||||||
|
};
|
||||||
|
config = {
|
||||||
|
ExposedPorts = {
|
||||||
|
"3000/tcp" = { };
|
||||||
|
};
|
||||||
|
Cmd = [ "${compiler-project}/bin/compiler-course" ];
|
||||||
|
};
|
||||||
|
}
|
|
@ -15,6 +15,7 @@ pkgs.mkShell {
|
||||||
rustc
|
rustc
|
||||||
rustfmt
|
rustfmt
|
||||||
clippy
|
clippy
|
||||||
|
docker
|
||||||
])
|
])
|
||||||
++ [ build-command ];
|
++ [ build-command ];
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue