Skip to content

Commit 38fb7d2

Browse files
committed
update readme
1 parent 6efe8e2 commit 38fb7d2

1 file changed

Lines changed: 40 additions & 5 deletions

File tree

README.md

Lines changed: 40 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ Images are built using using https://github.com/devcontainers/cli.
88

99
We build a base image based on mcr.microsoft.com/devcontainers/base:ubuntu-22.04 that other images are then based on
1010

11-
The images have vsocde user setup as user 1001 so that they can be used in github actions
12-
1311
The base image contains
1412
- latest os packages
1513
- asdf
@@ -109,11 +107,12 @@ This job should be used in github actions wherever you need to get the dev conta
109107
echo "DEVCONTAINER_IMAGE_VERSION=$DEVCONTAINER_VERSION" >> "$GITHUB_OUTPUT"
110108
```
111109
# Project structure
112-
We have 3 types of dev container. These are defined under src
110+
We have 4 types of dev container. These are defined under src
113111

114112
`base` - this is the base image that all others are based on.
115113
`languages` - this installs specific versions of node and python.
116-
`projects` - this is used for projects where more customization is needed than just a base language image
114+
`projects` - this is used for projects where more customization is needed than just a base language image.
115+
`githubactions` - this just takes an existing image and remaps vscode user to be 1001 so it can be used by github actions.
117116

118117
Each image to be built contains a .devcontainer folder that defines how the devcontainer should be built. At a minimum, this should contain a devcontainer.json file. See https://containers.dev/implementors/json_reference/ for options for this
119118

@@ -125,13 +124,15 @@ We use trivy to scan for vulnerabilities in the built docker images. Known vulne
125124
For each pull request, and merge to main, images are built and scanned using trivy, but the images are not pushed to github container registry
126125
Docker images are built for each pull request, and on merges to main.
127126
Docker images are built for amd64 and arm64 architecture, and a combined manifest is created and pushed as part of the build.
127+
Images are also created with user vscode mapped to user id 1001 so they can be used by github actions.
128128

129129
The base image is built first, and then language images, and finally project images.
130130

131131
Docker images are scanned for vulnerabilities using trivy as part of a build step, and the build fails if vulnerabilities are found not in .trivyignore file.
132132

133133
For pull requests, images are tagged with the pr-<pull request id>-<short commit sha>.
134134
For merges to main, images are tagged with the <short commit sha>.
135+
Github actions images are tagged with githubactions-<tag>
135136

136137
When a pull request is merged to main or closed, all associated images are deleted from the registry using the github workflow delete_old_images
137138

@@ -168,7 +169,6 @@ CONTAINER_NAME=fhir_facade_api \
168169
IMAGE_TAG=local-build \
169170
make build-image
170171
```
171-
172172
Github actions image
173173
```
174174
BASE_IMAGE_NAME=base \
@@ -245,3 +245,38 @@ poetry run python \
245245
--input .out/scan_results_docker.json \
246246
--output src/projects/fhir_facade_api/.trivyignore.new.yaml
247247
```
248+
249+
## Common makefile targets
250+
The common makefiles are defined in `src/base/.devcontainer/makefiles` and are included from `common.mk`.
251+
252+
You should add this to the end of project Makefile to include them
253+
```
254+
%:
255+
@$(MAKE) -f /usr/local/share/eps/makefiles/common.mk $@
256+
```
257+
258+
Build targets (`build.mk`)
259+
- `install` - placeholder target (currently not implemented)
260+
- `install-node` - placeholder target (currently not implemented)
261+
- `docker-build` - placeholder target (currently not implemented)
262+
- `compile` - placeholder target (currently not implemented)
263+
264+
Check targets (`check.mk`)
265+
- `lint` - placeholder target (currently not implemented)
266+
- `test` - placeholder target (currently not implemented)
267+
- `shellcheck` - runs shellcheck on `scripts/*.sh` and `.github/scripts/*.sh` when files exist
268+
- `cfn-lint` - runs `cfn-lint` against `cloudformation/**/*.yml|yaml` and `SAMtemplates/**/*.yml|yaml`
269+
- `cdk-synth` - placeholder target (currently not implemented)
270+
- `cfn-guard-sam-templates` - validates SAM templates against cfn-guard rulesets and writes outputs to `.cfn_guard_out/`
271+
- `cfn-guard-cloudformation` - validates `cloudformation` templates against cfn-guard rulesets and writes outputs to `.cfn_guard_out/`
272+
- `cfn-guard-cdk` - validates `cdk.out` against cfn-guard rulesets and writes outputs to `.cfn_guard_out/`
273+
- `cfn-guard-terraform` - validates `terraform_plans` against cfn-guard rulesets and writes outputs to `.cfn_guard_out/`
274+
275+
Trivy targets (`trivy.mk`)
276+
- `trivy-license-check` - runs Trivy license scan (HIGH/CRITICAL) and writes `.trivy_out/license_scan.txt`
277+
- `trivy-generate-sbom` - generates CycloneDX SBOM at `.trivy_out/sbom.cdx.json`
278+
- `trivy-scan-python` - scans Python dependencies (HIGH/CRITICAL) and writes `.trivy_out/dependency_results_python.txt`
279+
- `trivy-scan-node` - scans Node dependencies (HIGH/CRITICAL) and writes `.trivy_out/dependency_results_node.txt`
280+
- `trivy-scan-go` - scans Go dependencies (HIGH/CRITICAL) and writes `.trivy_out/dependency_results_go.txt`
281+
- `trivy-scan-java` - scans Java dependencies (HIGH/CRITICAL) and writes `.trivy_out/dependency_results_java.txt`
282+
- `trivy-scan-docker` - scans a built image (HIGH/CRITICAL) and writes `.trivy_out/dependency_results_docker.txt` (requires `DOCKER_IMAGE`), for example:

0 commit comments

Comments
 (0)