Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
#
# SPDX-License-Identifier: AGPL-3.0-or-later

# Doesn't need to be precise
env:
CURRENT_DATE: $(date --iso-8601=seconds)

steps:
# Checks for the whole repo
- label: check trailing whitespace
Expand Down Expand Up @@ -29,7 +33,7 @@ steps:
- nix-build -A checks.x86_64-linux.backend-test
- label: backend image
commands:
- nix-build -A packages.x86_64-linux.docker-backend
- nix-build -A packages.x86_64-linux.docker-backend --argstr creationDate "$CURRENT_DATE"
- buildkite-agent artifact upload "$(readlink -f result)"
- label: backend hlint
commands:
Expand All @@ -41,7 +45,7 @@ steps:
- nix-build -A packages.x86_64-linux.frontend
- label: frontend image
commands:
- nix-build -A packages.x86_64-linux.docker-frontend
- nix-build -A packages.x86_64-linux.docker-frontend --argstr creationDate "$CURRENT_DATE"
- buildkite-agent artifact upload "$(readlink -f result)"
- label: frontend tscompile
commands:
Expand All @@ -66,9 +70,9 @@ steps:
branches: "demo"
- label: Push backend image to registry
commands:
- nix-shell --run 'scripts/docker-push.sh docker-archive:$(nix-build -A packages.x86_64-linux.docker-backend) docker://ghcr.io/serokell/edna-backend:latest'
- nix-shell --run 'scripts/docker-push.sh docker-archive:$(nix-build -A packages.x86_64-linux.docker-backend --argstr creationDate "$CURRENT_DATE") docker://ghcr.io/serokell/edna-backend:latest'
branches: "master"
- label: Push frontend image to registry
commands:
- nix-shell --run 'scripts/docker-push.sh docker-archive:$(nix-build -A packages.x86_64-linux.docker-frontend) docker://ghcr.io/serokell/edna-frontend:latest'
- nix-shell --run 'scripts/docker-push.sh docker-archive:$(nix-build -A packages.x86_64-linux.docker-frontend --argstr creationDate "$CURRENT_DATE") docker://ghcr.io/serokell/edna-frontend:latest'
branches: "master"
5 changes: 4 additions & 1 deletion docker.nix
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
, glibcLocales
, linkFarm
, runCommand
, writeTextDir }:
, writeTextDir
, creationDate }:

let
inherit (dockerTools) buildLayeredImage buildImage pullImage;
Expand All @@ -26,6 +27,7 @@ in
in buildLayeredImage {
name = "ghcr.io/serokell/edna-backend";
tag = "latest";
created = creationDate;

contents = [
backend
Expand Down Expand Up @@ -78,6 +80,7 @@ in
in buildImage {
name = "ghcr.io/serokell/edna-frontend";
tag = "latest";
created = creationDate;
fromImage = nginx;
contents = [
html
Expand Down
11 changes: 6 additions & 5 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@
profile = with self.packages.${system};
linkFarm "edna-deploy-profile" [
{ name = "backend.tar.gz";
path = docker-backend; }
path = docker-backend { }; }
{ name = "frontend.tar.gz";
path = docker-frontend; }
path = docker-frontend { }; }
];
in {
hostname = "${hostName}.edna.serokell.team";
Expand Down Expand Up @@ -80,9 +80,10 @@
inherit analysis-env;
EDNA_ANALYSIS_DIR = ./analysis;
};
docker = pkgs.callPackage ./docker.nix {
docker = creationDate: pkgs.callPackage ./docker.nix {
backend = backend.server;
inherit frontend;
creationDate = creationDate;
};

frontend = pkgs.callPackage ./frontend { };
Expand All @@ -99,8 +100,8 @@
analysis-env = analysis-env;
backend-lib = backend.library;
backend-server = backend.server;
docker-backend = docker.backend-image;
docker-frontend = docker.frontend-image;
docker-backend = { creationDate ? "1970-01-01T00:00:01Z" }: (docker creationDate).backend-image;
docker-frontend = { creationDate ? "1970-01-01T00:00:01Z" }: (docker creationDate).frontend-image;
frontend = frontend;
};

Expand Down