Skip to content
Merged
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
3 changes: 1 addition & 2 deletions Dockerfile.ci-build
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ubuntu:22.04
FROM ubuntu:24.04


RUN apt update && \
Expand All @@ -11,7 +11,6 @@ RUN apt update && \
gnupg \
libbz2-dev \
libffi-dev \
libicu70 \
liblzma-dev \
libncursesw5-dev \
libreadline-dev \
Expand Down
14 changes: 9 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ PERFTEST_TYPE_DIST_PROFILE ?= default
PERFTEST_CUSTODIAN_DIST_PROFILE ?= default
PERFTEST_TOKEN_REFRESH_PORT ?= 8765

CI_BUILD_ARGS ?=
CI_IMAGE_TAG ?= $(shell date +%Y-%m-%d)

export PATH := $(PATH):$(PWD)/.venv/bin
export USE_SHARED_RESOURCES := $(shell poetry run python scripts/are_resources_shared_for_stack.py $(TF_WORKSPACE_NAME))

Expand Down Expand Up @@ -88,8 +91,9 @@ build-api-packages: ./api/consumer/* ./api/producer/*
build-ci-image: ## Build the CI image
@echo "Building the CI image"
docker build \
-t nhsd-nrlf-ci-build:latest \
-f Dockerfile.ci-build
-t localhost/nhsd-nrlf-ci-build:${CI_IMAGE_TAG} \
-f Dockerfile.ci-build \
${CI_BUILD_ARGS}

ecr-login: ## Login to NRLF ECR repo
@echo "Logging into ECR"
Expand All @@ -103,9 +107,9 @@ publish-ci-image: ## Publish the CI image
@echo "Publishing the CI image"
$(eval AWS_REGION := $(shell aws configure get region))
$(eval AWS_ACCOUNT_ID := $(shell aws sts get-caller-identity | jq -r .Account))
@docker tag nhsd-nrlf-ci-build:latest \
$(AWS_ACCOUNT_ID).dkr.ecr.$(AWS_REGION).amazonaws.com/nhsd-nrlf-ci-build:latest
@docker push $(AWS_ACCOUNT_ID).dkr.ecr.$(AWS_REGION).amazonaws.com/nhsd-nrlf-ci-build:latest
@docker tag localhost/nhsd-nrlf-ci-build:${CI_IMAGE_TAG} \
$(AWS_ACCOUNT_ID).dkr.ecr.$(AWS_REGION).amazonaws.com/nhsd-nrlf-ci-build:${CI_IMAGE_TAG}
@docker push $(AWS_ACCOUNT_ID).dkr.ecr.$(AWS_REGION).amazonaws.com/nhsd-nrlf-ci-build:${CI_IMAGE_TAG}

test: check-warn ## Run the unit tests
@echo "Running unit tests"
Expand Down
6 changes: 4 additions & 2 deletions terraform/account-wide-infrastructure/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@ If that has worked, you should see: "Your account is successfully connected thro

### Build and publish the container image for CI build

Once all the mgmt infra has been deployed, you need to build and publish the CI image to the ECR repo.
Once all the mgmt infra has been deployed, you need to build and publish the CI image to the ECR repo. Also follow these steps to update the CI build image.

To do this, first build the image as follows:
To do this, from the top-level of the repo, build the image as follows:

```
make build-ci-image
Expand All @@ -89,6 +89,8 @@ and push the image:
make publish-ci-image
```

This will create an image with a YYYY-MM-DD tag. You can then update the CI_IMAGE_TAG variable in `mgmt/vars.tf" and redeploy the mgmt resources to update codebuild to use the tagged image.

## Deploy account wide resources

> Run the [Deploy Account-wide infrastructure](https://github.com/NHSDigital/NRLF/actions/workflows/deploy-account-wide-infra.yml) github workflow to deploy account wide infrastructure. Select your branch/tag and `account-dev`, `account-test`, or `account-prod` to deploy infra to the corresponding account.
Expand Down
2 changes: 1 addition & 1 deletion terraform/account-wide-infrastructure/mgmt/codebuild.tf
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ resource "aws_codebuild_project" "project" {

environment {
compute_type = "BUILD_GENERAL1_SMALL"
image = "${aws_ecr_repository.repository.repository_url}:latest"
image = "${aws_ecr_repository.repository.repository_url}:${var.ci_image_tag}"
type = "LINUX_CONTAINER"
image_pull_credentials_type = "CODEBUILD"
}
Expand Down
6 changes: 6 additions & 0 deletions terraform/account-wide-infrastructure/mgmt/vars.tf
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,9 @@ variable "vpc_cidr_block" {
type = string
default = "10.0.0.0/16"
}

variable "ci_image_tag" {
description = "Tag for the CI image in ECR"
type = string
default = "2026-04-09"
}
Loading