Skip to content

Commit 11e7a1f

Browse files
author
Bingjie Liu
authored
Update docker files to use USER directives (#401)
* Update docker files to use USER directives * fix EPF smoke test * Add --no-cache flag to RUN apk update && apk add bash curl command * Add --no-install-recommends in dockerfile
1 parent 886bb80 commit 11e7a1f

12 files changed

+55
-14
lines changed

Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ ENV BUILD_NUMBER ${BUILD_NUMBER:-1_0_0}
1515

1616
RUN apt-get update && \
1717
apt-get -y upgrade && \
18-
apt-get install -y curl && \
18+
apt-get install -y --no-install-recommends curl && \
1919
rm -rf /var/lib/apt/lists/*
2020

2121
ENV TZ=Europe/London

Dockerfile.adjudications-api

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
FROM node:current-alpine3.17
22

3-
RUN apk update && apk add bash curl
3+
RUN apk update && apk add bash curl --no-cache
44

55
RUN curl https://manage-adjudications-api-dev.hmpps.service.justice.gov.uk/v3/api-docs > adjudications_api.json && \
66
npm install -g @stoplight/prism-cli
77

8+
RUN adduser -D user
9+
10+
USER user
11+
812
CMD prism mock -p 4010 -h 0.0.0.0 /adjudications_api.json
+6-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
FROM node:current-alpine3.17
22

3-
RUN apk update && apk add bash
3+
RUN apk update && apk add bash --no-cache
44

55
COPY src/main/kotlin/uk/gov/justice/digital/hmpps/hmppsintegrationapi/prismMocks/assess-risks-and-needs-api-docs.json /assess-risks-and-needs-api-docs.json
66

77
RUN npm install -g @stoplight/prism-cli
88

9-
CMD prism mock -p 4010 -h 0.0.0.0 /assess-risks-and-needs-api-docs.json
9+
RUN adduser -D user
10+
11+
USER user
12+
13+
CMD prism mock -p 4010 -h 0.0.0.0 /assess-risks-and-needs-api-docs.json

Dockerfile.setup-case-notes-api

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
11
FROM node:current-alpine3.17
22

3-
RUN apk update && apk add bash
3+
RUN apk update && apk add bash --no-cache
44

55
COPY src/main/kotlin/uk/gov/justice/digital/hmpps/hmppsintegrationapi/prismMocks/case-notes-api-docs.json /case-notes-api-docs.json
66

77
RUN npm install -g @stoplight/prism-cli
88

9+
RUN adduser -D user
10+
11+
USER user
12+
13+
914
CMD prism mock -p 4010 -h 0.0.0.0 /case-notes-api-docs.json
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
FROM node:current-alpine3.17
22

3-
RUN apk update && apk add bash
3+
RUN apk update && apk add bash --no-cache
44

55
COPY src/main/kotlin/uk/gov/justice/digital/hmpps/hmppsintegrationapi/prismMocks/create-and-vary-a-licence-api-docs.json /create-and-vary-a-licence-api-docs.json
66

77
RUN npm install -g @stoplight/prism-cli
88

9+
RUN adduser -D user
10+
11+
USER user
12+
913
CMD prism mock -p 4010 -h 0.0.0.0 /create-and-vary-a-licence-api-docs.json

Dockerfile.setup-manage-pom-case-api

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
FROM node:current-alpine3.17
22

3-
RUN apk update && apk add bash curl
3+
RUN apk update && apk add bash curl --no-cache
44

55
RUN curl https://allocation-manager-staging.apps.live.cloud-platform.service.justice.gov.uk/v3/api-docs.json > manage-pom-case-api.json && \
66
npm install -g @stoplight/prism-cli
77

8+
RUN adduser -D user
9+
10+
USER user
11+
812
CMD prism mock -p 4010 -h 0.0.0.0 /manage-pom-case-api.json

Dockerfile.setup-ndelius-api

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
FROM node:current-alpine3.17
22

3-
RUN apk update && apk add bash curl
3+
RUN apk update && apk add bash curl --no-cache
44

55
RUN curl https://ministryofjustice.github.io/hmpps-probation-integration-services/tech-docs/projects/external-api-and-delius/api-docs.json > ndelius-api.json && \
66
npm install -g @stoplight/prism-cli
77

8+
RUN adduser -D user
9+
10+
USER user
11+
812
CMD prism mock -p 4010 -h 0.0.0.0 /ndelius-api.json

Dockerfile.setup-prison-api

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
FROM node:current-alpine3.17
22

3-
RUN apk update && apk add bash curl
3+
RUN apk update && apk add bash curl --no-cache
44

55
RUN curl https://prison-api-dev.prison.service.justice.gov.uk/v3/api-docs > prison-api.json && \
66
npm install -g @stoplight/prism-cli
77

8+
RUN adduser -D user
9+
10+
USER user
11+
812
CMD prism mock -p 4010 -h 0.0.0.0 /prison-api.json

Dockerfile.setup-prisoner-search

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
FROM node:current-alpine3.17
22

3-
RUN apk update && apk add bash curl
3+
RUN apk update && apk add bash curl --no-cache
44

55
RUN curl https://prisoner-search-dev.prison.service.justice.gov.uk/v3/api-docs > prisoner-offender-search.json && \
66
sed -i "s+\*/\*+application/json+g" prisoner-offender-search.json && \
77
npm install -g @stoplight/prism-cli
88

9+
RUN adduser -D user
10+
11+
USER user
12+
913
CMD prism mock -p 4010 -h 0.0.0.0 /prisoner-offender-search.json
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
FROM node:current-alpine3.17
22

3-
RUN apk update && apk add bash curl
3+
RUN apk update && apk add bash curl --no-cache
44

55
RUN curl https://ministryofjustice.github.io/hmpps-probation-integration-services/tech-docs/projects/effective-proposal-framework-and-delius/api-docs.json > probation-integration-epf-api.json && \
66
npm install -g @stoplight/prism-cli
77

8-
CMD prism mock -p 4010 -h 0.0.0.0 /probation-integration-epf-api.json
8+
RUN adduser -D user
9+
10+
USER user
11+
12+
CMD prism mock -p 4010 -h 0.0.0.0 /probation-integration-epf-api.json
+5-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
FROM node:current-alpine3.17
22

3-
RUN apk update && apk add bash curl
3+
RUN apk update && apk add bash curl --no-cache
44

55
RUN curl https://probation-offender-search-dev.hmpps.service.justice.gov.uk/v3/api-docs > probation-offender-search.json && \
66
npm install -g @stoplight/prism-cli
77

8+
RUN adduser -D user
9+
10+
USER user
11+
812
CMD prism mock -p 4010 -h 0.0.0.0 /probation-offender-search.json

src/test/kotlin/uk/gov/justice/digital/hmpps/hmppsintegrationapi/smoke/EPFPersonDetailSmokeTest.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class EPFPersonDetailSmokeTest : DescribeSpec(
3232
"dateOfBirth":"2019-08-24",
3333
"gender": "string",
3434
"sentence": {
35-
"date": null,
35+
"date": "2019-08-24",
3636
"sentencingCourt": {
3737
"name": "string"
3838
},

0 commit comments

Comments
 (0)