Skip to content

Commit

Permalink
MAP-1450 Add Wiremock and Localstack setups and workflows (#59)
Browse files Browse the repository at this point in the history
* MAP-1450 Add Wiremock and Localstack setups and workflows

Created Dockerfiles for hmpps-wiremock and hmpps-localstack with necessary configurations. Added mock mappings for attribute-search and ping endpoints in Wiremock. Updated GitHub Actions workflows to include Wiremock and Localstack docker build and Trivy scan.

* MAP-1450 Add new Docker images to README.md table

Included `hmpps-wiremock` and `hmpps-localstack` in the Dockerfile directory table. Enhanced readability with better column alignment and formatting.
  • Loading branch information
Mjwillis authored Aug 7, 2024
1 parent 9aab59e commit 9c47343
Show file tree
Hide file tree
Showing 9 changed files with 74 additions and 8 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/docker-build-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ jobs:
- hmpps-devops-tools
- hmpps-mssql-tools
- hmpps-mysql-tools
- hmpps-wiremock
- hmpps-localstack
- hmpps-clamav
- hmpps-python-deps
permissions:
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/trivy_scan_latest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ jobs:
- hmpps-mssql-tools
- hmpps-mysql-tools
- hmpps-clamav
- hmpps-wiremock
- hmpps-localstack
permissions:
packages: write
contents: read
Expand Down
18 changes: 10 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,16 @@

These images are built in github actions see `.github/workflows/docker-build-push.yml` - and they are pushed to github packages.

| Dockerfile dir | Description | github package |
| --- | --- | --- |
| `hmpps-devops-tools` | contains various useful tools (az cli, aws cli, kubectl, helm), runs as non-root | <https://github.com/ministryofjustice/hmpps-tools-images/pkgs/container/hmpps-devops-tools> |
| `hmpps-mssql-tools` | contains mssql-tools and az cli. For sqlserver db refresh jobs | <https://github.com/ministryofjustice/hmpps-tools-images/pkgs/container/hmpps-mssql-tools> |
| `hmpps-mysql-tools` | contains mysql-client and aws cli. For mysql db refresh jobs, runs as non-root | <https://github.com/ministryofjustice/hmpps-tools-images/pkgs/container/hmpps-mysql-tools> |
| `hmpps-clamav` | ClamAV base image, see README in folder | <https://github.com/ministryofjustice/hmpps-tools-images/pkgs/container/hmpps-clamav> |
| `hmpps-clamav-freshclammed` | ClamAV image, twice daily updated virus DB, see README in folder | <https://github.com/ministryofjustice/hmpps-tools-images/pkgs/container/hmpps-clamav-freshclammed> |
| `hmpps-python-deps` | Python install with dependencies for running python scripts | <https://github.com/ministryofjustice/hmpps-utility-container-images/pkgs/container/hmpps-python-deps> |
| Dockerfile dir | Description | github package |
|-----------------------------|------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------|
| `hmpps-devops-tools` | contains various useful tools (az cli, aws cli, kubectl, helm), runs as non-root | <https://github.com/ministryofjustice/hmpps-tools-images/pkgs/container/hmpps-devops-tools> |
| `hmpps-mssql-tools` | contains mssql-tools and az cli. For sqlserver db refresh jobs | <https://github.com/ministryofjustice/hmpps-tools-images/pkgs/container/hmpps-mssql-tools> |
| `hmpps-mysql-tools` | contains mysql-client and aws cli. For mysql db refresh jobs, runs as non-root | <https://github.com/ministryofjustice/hmpps-tools-images/pkgs/container/hmpps-mysql-tools> |
| `hmpps-wiremock` | contains a CP friendly wiremock docker image. Runs as non-root and can add new responses as required | <https://github.com/ministryofjustice/hmpps-tools-images/pkgs/container/hmpps-wiremock> |
| `hmpps-localstack` | contains a CP localstack. Runs as non-root | <https://github.com/ministryofjustice/hmpps-tools-images/pkgs/container/hmpps-localstack> |
| `hmpps-clamav` | ClamAV base image, see README in folder | <https://github.com/ministryofjustice/hmpps-tools-images/pkgs/container/hmpps-clamav> |
| `hmpps-clamav-freshclammed` | ClamAV image, twice daily updated virus DB, see README in folder | <https://github.com/ministryofjustice/hmpps-tools-images/pkgs/container/hmpps-clamav-freshclammed> |
| `hmpps-python-deps` | Python install with dependencies for running python scripts | <https://github.com/ministryofjustice/hmpps-utility-container-images/pkgs/container/hmpps-python-deps> |

## Trivy Scan

Expand Down
5 changes: 5 additions & 0 deletions hmpps-localstack/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
FROM localstack/localstack:stable
RUN chown localstack:localstack -R /tmp/localstack && \
chown localstack:localstack -R /var/lib/localstack
USER 1000

7 changes: 7 additions & 0 deletions hmpps-wiremock/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FROM wiremock/wiremock:latest
RUN addgroup --gid 2000 --system wiremock && adduser --uid 2000 --system wiremock --gid 2000

COPY --chown=wiremock:wiremock wiremock /home/wiremock

USER 2000
ENTRYPOINT ["/docker-entrypoint.sh", "--port=8090", "--global-response-templating", "--disable-gzip", "--verbose"]
19 changes: 19 additions & 0 deletions hmpps-wiremock/wiremock/__files/attribute-search.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"empty": true,
"totalPages": 0,
"totalElements": 0,
"first": true,
"last": true,
"size": 0,
"number": 0,
"numberOfElements": 10,
"pageable": {
"offset": 0,
"pageSize": 0,
"paged": true,
"pageNumber": 0,
"unpaged": true
},
"content": [
]
}
3 changes: 3 additions & 0 deletions hmpps-wiremock/wiremock/__files/ping.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"status": "UP"
}
13 changes: 13 additions & 0 deletions hmpps-wiremock/wiremock/mappings/atrribute-search.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"request": {
"method": "POST",
"urlPath": "/attribute-search"
},
"response": {
"status": 200,
"headers": {
"Content-Type": "application/json"
},
"bodyFileName": "attribute-search.json"
}
}
13 changes: 13 additions & 0 deletions hmpps-wiremock/wiremock/mappings/ping.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"request": {
"method": "GET",
"urlPath": "/health/ping"
},
"response": {
"status": 200,
"bodyFileName": "ping.json",
"headers": {
"Content-Type": "application/json"
}
}
}

0 comments on commit 9c47343

Please sign in to comment.