Skip to content

Commit 0b4ca8d

Browse files
Merge pull request #1199 from NHSDigital/feature/made14-NRL-1935-update-ci-build-image
[NRL-1935] Update CI image build to Ubuntu 24.04
2 parents e2ea8f8 + e24c4dc commit 0b4ca8d

File tree

5 files changed

+21
-10
lines changed

5 files changed

+21
-10
lines changed

Dockerfile.ci-build

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM ubuntu:22.04
1+
FROM ubuntu:24.04
22

33

44
RUN apt update && \
@@ -11,7 +11,6 @@ RUN apt update && \
1111
gnupg \
1212
libbz2-dev \
1313
libffi-dev \
14-
libicu70 \
1514
liblzma-dev \
1615
libncursesw5-dev \
1716
libreadline-dev \

Makefile

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ PERFTEST_TYPE_DIST_PROFILE ?= default
2323
PERFTEST_CUSTODIAN_DIST_PROFILE ?= default
2424
PERFTEST_TOKEN_REFRESH_PORT ?= 8765
2525

26+
CI_BUILD_ARGS ?=
27+
CI_IMAGE_TAG ?= $(shell date +%Y-%m-%d)
28+
2629
export PATH := $(PATH):$(PWD)/.venv/bin
2730
export USE_SHARED_RESOURCES := $(shell poetry run python scripts/are_resources_shared_for_stack.py $(TF_WORKSPACE_NAME))
2831

@@ -88,8 +91,9 @@ build-api-packages: ./api/consumer/* ./api/producer/*
8891
build-ci-image: ## Build the CI image
8992
@echo "Building the CI image"
9093
docker build \
91-
-t nhsd-nrlf-ci-build:latest \
92-
-f Dockerfile.ci-build
94+
-t localhost/nhsd-nrlf-ci-build:${CI_IMAGE_TAG} \
95+
-f Dockerfile.ci-build \
96+
${CI_BUILD_ARGS}
9397

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

110114
test: check-warn ## Run the unit tests
111115
@echo "Running unit tests"

terraform/account-wide-infrastructure/README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,9 @@ If that has worked, you should see: "Your account is successfully connected thro
6969
7070
### Build and publish the container image for CI build
7171
72-
Once all the mgmt infra has been deployed, you need to build and publish the CI image to the ECR repo.
72+
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.
7373
74-
To do this, first build the image as follows:
74+
To do this, from the top-level of the repo, build the image as follows:
7575
7676
```
7777
make build-ci-image
@@ -89,6 +89,8 @@ and push the image:
8989
make publish-ci-image
9090
```
9191
92+
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.
93+
9294
## Deploy account wide resources
9395
9496
> 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.

terraform/account-wide-infrastructure/mgmt/codebuild.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ resource "aws_codebuild_project" "project" {
9090

9191
environment {
9292
compute_type = "BUILD_GENERAL1_SMALL"
93-
image = "${aws_ecr_repository.repository.repository_url}:latest"
93+
image = "${aws_ecr_repository.repository.repository_url}:${var.ci_image_tag}"
9494
type = "LINUX_CONTAINER"
9595
image_pull_credentials_type = "CODEBUILD"
9696
}

terraform/account-wide-infrastructure/mgmt/vars.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,9 @@ variable "vpc_cidr_block" {
2828
type = string
2929
default = "10.0.0.0/16"
3030
}
31+
32+
variable "ci_image_tag" {
33+
description = "Tag for the CI image in ECR"
34+
type = string
35+
default = "2026-04-09"
36+
}

0 commit comments

Comments
 (0)