WIP: Build Hello image in CI

This commit is contained in:
Garrett George 2023-03-16 18:48:11 -05:00
parent 34507735a8
commit 0b00f87d61
2 changed files with 27 additions and 1 deletions

View file

@ -43,3 +43,7 @@ jobs:
# continue-on-error: true # continue-on-error: true
- run: nix build - run: nix build
# To get image and layered image into binary cache
- run: nix build .#image
- run: nix build .#layeredImage

View file

@ -1,5 +1,5 @@
{ {
description = "LiveBeats"; description = "Play music together with Phoenix LiveView!";
inputs = { inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable"; nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
@ -11,12 +11,33 @@
let let
# pkgs = nixpkgs.legacyPackages.${system}; # pkgs = nixpkgs.legacyPackages.${system};
pkgs = import nixpkgs { inherit system; }; pkgs = import nixpkgs { inherit system; };
imagePkgs = import nixpkgs { system = "x86_64-linux"; };
in in
rec { rec {
packages = { packages = {
live-beats = pkgs.callPackage ./pkgs/live-beats { inherit pkgs self; }; live-beats = pkgs.callPackage ./pkgs/live-beats { inherit pkgs self; };
default = packages.live-beats; default = packages.live-beats;
image = pkgs.dockerTools.buildImage {
name = "hello";
tag = "latest";
created = "now";
copyToRoot = pkgs.buildEnv {
name = "image-root";
paths = [ pkgs.hello ];
pathsToLink = [ "/bin" ];
};
config.Cmd = [ "/bin/hello" ];
};
layeredImage = pkgs.dockerTools.buildLayeredImage {
name = "hello";
config = {
Cmd = [ "${pkgs.hello}/bin/hello" ];
};
};
}; };
@ -25,6 +46,7 @@
dev = import ./pkgs/dev-shell { dev = import ./pkgs/dev-shell {
inherit pkgs; inherit pkgs;
inputsFrom = [ packages.live-beats ];
db_name = "db_dev"; db_name = "db_dev";
# MIX_ENV = "dev"; # MIX_ENV = "dev";
}; };