generated from DimensionDev/aws_lambda_rust_template
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[#] Build docker image using nix instead of github action
- Loading branch information
Showing
6 changed files
with
71 additions
and
107 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,16 +10,51 @@ | |
let | ||
pkgs = import nixpkgs { inherit system; }; | ||
naersk-lib = pkgs.callPackage naersk { }; | ||
buildInputs = with pkgs; [ openssl pkg-config ]; | ||
nativeBuildInputs = with pkgs; [ cargo rustc rustfmt rust-analyzer pre-commit rustPackages.clippy ]; | ||
in | ||
{ | ||
defaultPackage = naersk-lib.buildPackage { | ||
inherit buildInputs; | ||
buildInputs = with pkgs; [ openssl cacert curl ]; | ||
nativeBuildInputs = with pkgs; [ pkg-config cargo rustc rustfmt rustPackages.clippy ]; | ||
rustPackage = naersk-lib.buildPackage { | ||
inherit buildInputs nativeBuildInputs; | ||
# China registry mirror | ||
cratesDownloadUrl = "https://crates-io.proxy.ustclug.org"; | ||
src = ./.; | ||
}; | ||
dockerImage = pkgs.dockerTools.buildLayeredImage { | ||
name = "nextdotid/relation_server"; | ||
tag = "latest"; | ||
created = "now"; | ||
contents = [ rustPackage pkgs.curl pkgs.cacert ]; | ||
config = { | ||
Workingdir = "/app"; | ||
Cmd = [ "standalone" ]; | ||
ExposedPorts = { | ||
"8000/tcp" = {}; | ||
}; | ||
Volumes = { | ||
"/app/config" = {}; | ||
}; | ||
Test = [ "CMD" "curl" "-s" "http://127.0.0.1:8000/" ]; | ||
Interval = 30000000000; # 30s | ||
Timeout = 10000000000; # 10s | ||
Retries = 3; | ||
Labels = { | ||
"maintainer" = "Nyk Ma <[email protected]>"; | ||
"org.opencontainers.image.description" = "RelationService: relation aggregation."; | ||
"org.opencontainers.image.source" = "https://github.com/NextDotID/relation_server"; | ||
"org.opencontainers.image.title" = "relation_server"; | ||
"org.opencontainers.image.url" = "https://github.com/NextDotID/relation_server"; | ||
}; | ||
}; | ||
}; | ||
in { | ||
packages = { | ||
main = rustPackage; | ||
docker = dockerImage; | ||
}; | ||
defaultPackage = rustPackage; | ||
devShell = with pkgs; mkShell { | ||
buildInputs = buildInputs ++ nativeBuildInputs; | ||
buildInputs = buildInputs ++ | ||
nativeBuildInputs ++ | ||
(with pkgs; [ act rust-analyzer pre-commit ]); | ||
RUST_SRC_PATH = rustPlatform.rustLibSrc; | ||
}; | ||
}); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters