Skip to content

Commit

Permalink
feat: add docker image
Browse files Browse the repository at this point in the history
  • Loading branch information
frectonz committed Oct 11, 2024
1 parent 650b3c9 commit 1b7982f
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 3 deletions.
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,16 @@ Options:
Print version
```

## Run it with Docker

```
docker run -p 3030:3030 \
-e ADDRESS="0.0.0.0:3030" \
-e REGISTRY_URL="<registry_url>" \
-e REGISTRY_CREDENTIALS="<username>:<password>" \
frectonz/octopod
```

## Install

### Linux and MacOS
Expand Down
20 changes: 17 additions & 3 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,12 @@
cargo = pkgs.rust-bin.stable.latest.default;
rustc = pkgs.rust-bin.stable.latest.default;
};
in {

pname = "octopod";
version = "0.1.1";
in rec {
default = rustPlatform.buildRustPackage {
pname = "octopod";
version = "0.1.0";
inherit pname version;
src = ./.;

preBuild = ''
Expand All @@ -62,6 +64,18 @@

cargoLock.lockFile = ./Cargo.lock;
};

image = pkgs.dockerTools.buildLayeredImage {
name = pname;
tag = "latest";
created = "now";
config.Cmd = [ "${default}/bin/octopod" ];
};

deploy = pkgs.writeShellScriptBin "deploy" ''
${pkgs.skopeo}/bin/skopeo --insecure-policy copy docker-archive:${image} docker://docker.io/frectonz/octopod:${version} --dest-creds="frectonz:$ACCESS_TOKEN"
${pkgs.skopeo}/bin/skopeo --insecure-policy copy docker://docker.io/frectonz/octopod:${version} docker://docker.io/frectonz/octopod:latest --dest-creds="frectonz:$ACCESS_TOKEN"
'';
});

formatter = forAllSystems (pkgs: pkgs.nixfmt-classic);
Expand Down

0 comments on commit 1b7982f

Please sign in to comment.