aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.github/workflows/publish-docker.yml35
-rw-r--r--flake.nix31
2 files changed, 62 insertions, 4 deletions
diff --git a/.github/workflows/publish-docker.yml b/.github/workflows/publish-docker.yml
new file mode 100644
index 0000000..d958e57
--- /dev/null
+++ b/.github/workflows/publish-docker.yml
@@ -0,0 +1,35 @@
1name: pubish docker image
2
3on:
4 push:
5 branches:
6 - master
7
8jobs:
9 build-and-publish:
10 runs-on: ubuntu-latest
11
12 steps:
13 - name: checkout repository
14 uses: actions/checkout@v4
15
16 - name: install nix
17 uses: cachix/install-nix-action@v27
18 with:
19 github_access_token: ${{ secrets.GITHUB_TOKEN }}
20
21 - name: build docker image
22 run: nix build -L .#dockerImage
23
24 - name: log in to github container registry
25 uses: docker/login-action@v3
26 with:
27 registry: ghcr.io
28 username: ${{ github.actor }}
29 password: ${{ secrets.GITHUB_TOKEN }}
30
31 - name: publish docker image
32 run: |
33 docker load < result
34 docker tag lurker:latest ghcr.io/${{ github.repository_owner }}/lurker:latest
35 docker push ghcr.io/${{ github.repository_owner }}/lurker:latest
diff --git a/flake.nix b/flake.nix
index f1f3456..2384dcd 100644
--- a/flake.nix
+++ b/flake.nix
@@ -17,7 +17,10 @@
17 ]; 17 ];
18 }); 18 });
19 in { 19 in {
20 overlays.default = final: prev: { 20 overlays.default = final: prev: let
21 pname = "lurker";
22 version = "0.1.0";
23 in {
21 node_modules = with final; 24 node_modules = with final;
22 stdenv.mkDerivation { 25 stdenv.mkDerivation {
23 pname = "lurker-node-modules"; 26 pname = "lurker-node-modules";
@@ -44,8 +47,7 @@
44 }; 47 };
45 lurker = with final; 48 lurker = with final;
46 stdenv.mkDerivation { 49 stdenv.mkDerivation {
47 pname = "lurker"; 50 inherit pname version;
48 version = "0.0.1";
49 src = ./.; 51 src = ./.;
50 nativeBuildInputs = [makeBinaryWrapper]; 52 nativeBuildInputs = [makeBinaryWrapper];
51 buildInputs = [bun]; 53 buildInputs = [bun];
@@ -71,6 +73,27 @@
71 73
72 ''; 74 '';
73 }; 75 };
76 dockerImage = with final;
77 final.dockerTools.buildImage {
78 name = pname;
79 tag = "latest";
80
81 copyToRoot = final.buildEnv {
82 name = "image-root";
83 paths = [ final.lurker ];
84 pathsToLink = [ "/bin" ];
85 };
86
87 runAsRoot = ''
88 mkdir -p /data
89 '';
90
91 config = {
92 Cmd = ["/bin/${pname}"];
93 WorkingDir = "/data";
94 Volumes = {"/data" = {};};
95 };
96 };
74 }; 97 };
75 98
76 devShell = forAllSystems (system: let 99 devShell = forAllSystems (system: let
@@ -84,7 +107,7 @@
84 }); 107 });
85 108
86 packages = forAllSystems (system: { 109 packages = forAllSystems (system: {
87 inherit (nixpkgsFor."${system}") lurker node_modules; 110 inherit (nixpkgsFor."${system}") lurker node_modules dockerImage;
88 }); 111 });
89 112
90 defaultPackage = forAllSystems (system: nixpkgsFor."${system}".lurker); 113 defaultPackage = forAllSystems (system: nixpkgsFor."${system}".lurker);