generated from ministryofjustice/template-repository
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Jacob Woffenden <[email protected]>
- Loading branch information
Jacob Woffenden
authored
Oct 15, 2024
1 parent
a6ce141
commit b2c0dfc
Showing
24 changed files
with
786 additions
and
77 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{ | ||
"features": { | ||
"ghcr.io/devcontainers/features/docker-in-docker:2": { | ||
"version": "2.12.0", | ||
"resolved": "ghcr.io/devcontainers/features/docker-in-docker@sha256:5f3e2005aad161ce3ff7700b2603f11935348c039f9166960efd050d69cd3014", | ||
"integrity": "sha256:5f3e2005aad161ce3ff7700b2603f11935348c039f9166960efd050d69cd3014" | ||
}, | ||
"ghcr.io/ministryofjustice/devcontainer-feature/container-structure-test:1": { | ||
"version": "1.0.0", | ||
"resolved": "ghcr.io/ministryofjustice/devcontainer-feature/container-structure-test@sha256:19eb30f9eb327b667be2002757d55381de87cdb5a79a6e37d293369fe8ad01ad", | ||
"integrity": "sha256:19eb30f9eb327b667be2002757d55381de87cdb5a79a6e37d293369fe8ad01ad", | ||
"dependsOn": [ | ||
"ghcr.io/devcontainers/features/docker-in-docker:2" | ||
] | ||
}, | ||
"ghcr.io/ministryofjustice/devcontainer-feature/static-analysis:1": { | ||
"version": "1.0.0", | ||
"resolved": "ghcr.io/ministryofjustice/devcontainer-feature/static-analysis@sha256:e81d52725655c8ffb861605feac7ad155b447d51af65f6c3a03cab32d59f1e16", | ||
"integrity": "sha256:e81d52725655c8ffb861605feac7ad155b447d51af65f6c3a03cab32d59f1e16" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
{ | ||
"name": "analytical-platform-cloud-development-environment-nginx-proxy", | ||
"image": "ghcr.io/ministryofjustice/devcontainer-base:latest", | ||
"features": { | ||
"ghcr.io/devcontainers/features/docker-in-docker:2": {}, | ||
"ghcr.io/ministryofjustice/devcontainer-feature/container-structure-test:1": {}, | ||
"ghcr.io/ministryofjustice/devcontainer-feature/static-analysis:1": {} | ||
}, | ||
"customizations": { | ||
"vscode": { | ||
"extensions": [ | ||
"EditorConfig.EditorConfig", | ||
"GitHub.vscode-github-actions", | ||
"GitHub.vscode-pull-request-github", | ||
"sumneko.lua" | ||
], | ||
"settings": { | ||
"files.associations": { | ||
"src/etc/nginx/nginx.conf.template": "properties" | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
root = true | ||
|
||
[*] | ||
end_of_line = lf | ||
insert_final_newline = true | ||
trim_trailing_whitespace = true | ||
|
||
[*.json] | ||
indent_style = space | ||
indent_size = 2 | ||
|
||
[*.sh] | ||
indent_style = space | ||
indent_size = 2 | ||
|
||
[{*.yml,*.yaml}] | ||
indent_style = space | ||
indent_size = 2 | ||
|
||
# This file is autogenerated | ||
[.devcontainer/devcontainer-lock.json] | ||
end_of_line = unset | ||
insert_final_newline = unset |
Validating CODEOWNERS rules …
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1 @@ | ||
# Add a team or username to this file | ||
# Example: | ||
# * @ministryofjustice/operations-engineering | ||
* @ministryofjustice/analytical-platform |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,25 @@ | ||
--- | ||
# To get started with Dependabot version updates, you'll need to specify which | ||
# package ecosystems to update and where the package manifests are located. | ||
# Please see the documentation for all configuration options: | ||
# https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file | ||
|
||
version: 2 | ||
|
||
updates: | ||
- package-ecosystem: "bundler" | ||
directory: "/" | ||
schedule: | ||
interval: "daily" | ||
- package-ecosystem: "terraform" | ||
directory: "/terraform" | ||
schedule: | ||
interval: "daily" | ||
- package-ecosystem: "github-actions" | ||
directory: "/" | ||
schedule: | ||
interval: "daily" | ||
- package-ecosystem: "pip" | ||
directory: "/" | ||
schedule: | ||
interval: "daily" | ||
- package-ecosystem: "npm" | ||
directory: "/" | ||
schedule: | ||
interval: "daily" | ||
- package-ecosystem: "gomod" | ||
commit-message: | ||
prefix: ":dependabot: github-actions" | ||
include: "scope" | ||
- package-ecosystem: "devcontainers" | ||
directory: "/" | ||
schedule: | ||
interval: "daily" | ||
commit-message: | ||
prefix: ":dependabot: devcontainers" | ||
include: "scope" | ||
- package-ecosystem: "docker" | ||
directory: "/" | ||
schedule: | ||
interval: "daily" | ||
commit-message: | ||
prefix: ":dependabot: docker" | ||
include: "scope" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
--- | ||
name: 🔖 Release | ||
|
||
on: | ||
push: | ||
tags: | ||
- "*" | ||
|
||
permissions: {} | ||
|
||
jobs: | ||
release: | ||
name: Release | ||
runs-on: ubuntu-latest | ||
permissions: | ||
actions: read | ||
attestations: write | ||
contents: write | ||
id-token: write | ||
packages: write | ||
steps: | ||
- name: Checkout | ||
id: checkout | ||
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1 | ||
|
||
- name: Install cosign | ||
id: install_cosign | ||
uses: sigstore/cosign-installer@dc72c7d5c4d10cd6bcb8cf6e3fd625a9e5e537da # v3.7.0 | ||
|
||
- name: Log in to GitHub Container Registry | ||
id: ghcr_login | ||
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Build and Push | ||
id: build_and_push | ||
uses: docker/build-push-action@4f58ea79222b3b9dc2c8bbdd6debcef730109a75 # v6.9.0 | ||
with: | ||
push: true | ||
tags: ghcr.io/${{ github.repository }}:${{ github.ref_name }} | ||
|
||
- name: Sign | ||
id: sign | ||
shell: bash | ||
run: | | ||
cosign sign --yes ghcr.io/${{ github.repository }}@${{ steps.build_and_push.outputs.digest }} | ||
- name: Generate SBOM | ||
id: generate_sbom | ||
uses: anchore/sbom-action@f5e124a5e5e1d497a692818ae907d3c45829d033 # v0.17.3 | ||
with: | ||
image: ghcr.io/${{ github.repository }}:${{ github.ref_name }} | ||
format: cyclonedx-json | ||
output-file: "sbom.cyclonedx.json" | ||
|
||
- name: Attest | ||
uses: actions/attest-build-provenance@1c608d11d69870c2092266b3f9a6f3abbf17002c # v1.4.3 | ||
id: attest | ||
with: | ||
subject-name: ghcr.io/${{ github.repository }} | ||
subject-digest: ${{ steps.build_and_push.outputs.digest }} | ||
push-to-registry: true | ||
|
||
- name: Attest SBOM | ||
uses: actions/attest-sbom@5026d3663739160db546203eeaffa6aa1c51a4d6 # v1.4.1 | ||
id: attest_sbom | ||
with: | ||
subject-name: ghcr.io/${{ github.repository }} | ||
subject-digest: ${{ steps.build_and_push.outputs.digest }} | ||
sbom-path: sbom.cyclonedx.json | ||
push-to-registry: true | ||
|
||
- name: cosign Verify | ||
id: cosign_verify | ||
shell: bash | ||
run: | | ||
cosign verify \ | ||
--certificate-oidc-issuer=https://token.actions.githubusercontent.com \ | ||
--certificate-identity=https://github.com/${{ github.workflow_ref }} \ | ||
ghcr.io/${{ github.repository }}@${{ steps.build_and_push.outputs.digest }} | ||
- name: GitHub Attestation Verify | ||
id: gh_attestation_verify | ||
shell: bash | ||
env: | ||
GH_TOKEN: ${{ github.token }} | ||
run: | | ||
gh attestation verify oci://ghcr.io/${{ github.repository }}:${{ github.ref_name }} --repo ${{ github.repository }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
--- | ||
name: 🩻 Scan | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
permissions: {} | ||
|
||
jobs: | ||
scan: | ||
name: Scan | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
steps: | ||
- name: Checkout | ||
id: checkout | ||
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1 | ||
|
||
- name: Build | ||
id: build | ||
shell: bash | ||
env: | ||
IMAGE_NAME: ghcr.io/${{ github.repository }} | ||
IMAGE_TAG: ${{ github.sha }} | ||
run: | | ||
make build | ||
- name: Scan | ||
id: scan | ||
uses: aquasecurity/trivy-action@5681af892cd0f4997658e2bacc62bd0a894cf564 # v0.27.0 | ||
env: | ||
TRIVY_DB_REPOSITORY: public.ecr.aws/aquasecurity/trivy-db:2 | ||
TRIVY_JAVA_DB_REPOSITORY: public.ecr.aws/aquasecurity/trivy-java-db:1 | ||
with: | ||
image-ref: ghcr.io/${{ github.repository }}:${{ github.sha }} | ||
severity: HIGH,CRITICAL | ||
exit-code: 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
--- | ||
name: 🦝 Super-Linter | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
types: | ||
- edited | ||
- opened | ||
- reopened | ||
- synchronize | ||
|
||
permissions: {} | ||
|
||
jobs: | ||
super-linter: | ||
name: Super-Linter | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
statuses: write | ||
steps: | ||
- name: Checkout | ||
id: checkout | ||
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Super-Linter | ||
id: super_linter | ||
uses: super-linter/super-linter/slim@b92721f792f381cedc002ecdbb9847a15ece5bb8 # v7.1.0 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
VALIDATE_LUA: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
--- | ||
name: 🧪 Test | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
permissions: {} | ||
|
||
jobs: | ||
test: | ||
name: Test | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
steps: | ||
- name: Checkout | ||
id: checkout | ||
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1 | ||
|
||
- name: Set Up Container Structure Test | ||
id: setup_container_structure_test | ||
uses: ministryofjustice/github-actions/setup-container-structure-test@e08cbcac12ec9c09d867ab2b803d4ea1a87300ad # v18.2.4 | ||
|
||
- name: Test | ||
id: test | ||
shell: bash | ||
env: | ||
IMAGE_TAG: ${{ github.sha }} | ||
run: | | ||
make test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# This file is generated automatically | ||
.devcontainer/devcontainer-lock.json | ||
|
||
# This file is out of scope right now | ||
src/srv/www/404.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# I am skipping these CVEs because while they are fixed in APK, I do not want to run `apk update && apk upgrade` as the image won't be reproducible | ||
# We currently consume docker.io/openresty/openresty:1.25.3.2-alpine-fat but intend to refactor and switch to Ubuntu LTS for two reasons | ||
# 1. We can fully control the base image, so nonroot and package version | ||
# 2. OpenResty publish an APT distrobution we can use | ||
CVE-2024-5171 | ||
CVE-2024-6197 | ||
CVE-2024-45490 | ||
CVE-2024-45491 | ||
CVE-2024-45492 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#checkov:skip=CKV_DOCKER_3: Current implementation uses off-the-shelf image from OpenResty which doesn't offer a nonroot variant | ||
|
||
# docker.io/openresty/openresty:1.25.3.2-alpine-fat | ||
FROM docker.io/openresty/openresty@sha256:aa8ea52fa35a296558aed8b392fb39d575e39dd4a7717fa44f1fd6fc09c1185d | ||
|
||
LABEL org.opencontainers.image.vendor="Ministry of Justice" \ | ||
org.opencontainers.image.authors="Analytical Platform ([email protected])" \ | ||
org.opencontainers.image.title="Cloud Development Environment NGINX Proxy" \ | ||
org.opencontainers.image.description="Cloud Development Environment NGINX proxy image for Analytical Platform" \ | ||
org.opencontainers.image.url="https://github.com/ministryofjustice/analytical-platform-cloud-development-environment-nginx-proxy" | ||
|
||
RUN <<EOF | ||
luarocks install lua-resty-openidc 1.8.0 | ||
EOF | ||
|
||
COPY src/etc/nginx /etc/nginx | ||
COPY src/opt/lua-scripts /opt/lua-scripts | ||
COPY src/srv/www /srv/www | ||
COPY --chown=nobody:nobody --chmod=0755 src/usr/local/bin /usr/local/bin | ||
|
||
EXPOSE 3000 | ||
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"] | ||
HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 CMD ["/usr/local/bin/healthcheck.sh"] |
Oops, something went wrong.