Merge pull request #16 from mkilijanek/codex/add-docker-image-build-instructions
Codex/add docker image build instructions
This commit is contained in:
commit
1f63f48246
6
.github/workflows/codeql-analysis.yml
vendored
6
.github/workflows/codeql-analysis.yml
vendored
@ -57,9 +57,3 @@ jobs:
|
||||
with:
|
||||
category: "/language:${{ matrix.language }}"
|
||||
upload: true
|
||||
|
||||
- name: Upload SARIF results
|
||||
if: always()
|
||||
uses: github/codeql-action/upload-sarif@v3
|
||||
with:
|
||||
sarif_file: ../results
|
||||
|
||||
72
.github/workflows/master.yml
vendored
72
.github/workflows/master.yml
vendored
@ -2,9 +2,27 @@ name: "Master Build, Test & Deploy"
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
nightly:
|
||||
description: "Tag build as nightly"
|
||||
required: false
|
||||
default: "false"
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
schedule:
|
||||
# Weekly build and publish to keep images fresh
|
||||
- cron: '0 3 * * 1'
|
||||
|
||||
env:
|
||||
REGISTRY: ghcr.io
|
||||
IMAGE_NAME: ${{ github.repository }}
|
||||
PLATFORMS: linux/amd64,linux/arm64
|
||||
|
||||
env:
|
||||
REGISTRY: ghcr.io
|
||||
IMAGE_NAME: ${{ github.repository }}
|
||||
PLATFORMS: linux/amd64,linux/arm64
|
||||
|
||||
jobs:
|
||||
main:
|
||||
@ -56,3 +74,57 @@ jobs:
|
||||
build_dir: ./build/prod
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
docker-images:
|
||||
name: Build & Publish Docker Images
|
||||
runs-on: ubuntu-latest
|
||||
needs: main
|
||||
if: github.ref == 'refs/heads/master'
|
||||
permissions:
|
||||
contents: read
|
||||
packages: write
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v3
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Log in to GitHub Container Registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ${{ env.REGISTRY }}
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Set extra tags
|
||||
run: |
|
||||
if [ "${{ github.event_name }}" = "workflow_dispatch" ] && [ "${{ github.event.inputs.nightly }}" = "true" ]; then
|
||||
echo "EXTRA_TAGS=type=raw,value=nightly" >> $GITHUB_ENV
|
||||
else
|
||||
echo "EXTRA_TAGS=" >> $GITHUB_ENV
|
||||
fi
|
||||
|
||||
- name: Docker metadata
|
||||
id: meta
|
||||
uses: docker/metadata-action@v5
|
||||
with:
|
||||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
||||
tags: |
|
||||
type=raw,value=latest
|
||||
type=sha,format=long
|
||||
${{ env.EXTRA_TAGS }}
|
||||
|
||||
- name: Build and push multi-arch image
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: .
|
||||
file: ./Dockerfile
|
||||
platforms: ${{ env.PLATFORMS }}
|
||||
push: true
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=max
|
||||
|
||||
41
Makefile
Normal file
41
Makefile
Normal file
@ -0,0 +1,41 @@
|
||||
# Multi-platform Docker build and publish for CyberChef
|
||||
|
||||
IMAGE_NAME ?= ghcr.io/gchq/cyberchef
|
||||
PLATFORMS ?= linux/amd64,linux/arm64
|
||||
MONTHLY_TAG ?= $(shell date +%Y-%m)
|
||||
|
||||
.PHONY: check-branch build publish scan
|
||||
|
||||
check-branch:
|
||||
@current=$$(git rev-parse --abbrev-ref HEAD); \
|
||||
if [ "$$current" != "main" ]; then \
|
||||
echo "Builds must run from the main branch (current: $$current)"; \
|
||||
exit 1; \
|
||||
fi
|
||||
|
||||
build: check-branch
|
||||
docker buildx build \
|
||||
--pull \
|
||||
--platform $(PLATFORMS) \
|
||||
--tag $(IMAGE_NAME):latest \
|
||||
--tag $(IMAGE_NAME):$(MONTHLY_TAG) \
|
||||
--sbom=true \
|
||||
--provenance=true \
|
||||
--output=type=docker \
|
||||
.
|
||||
|
||||
publish: check-branch
|
||||
docker buildx build \
|
||||
--pull \
|
||||
--platform $(PLATFORMS) \
|
||||
--tag $(IMAGE_NAME):latest \
|
||||
--tag $(IMAGE_NAME):$(MONTHLY_TAG) \
|
||||
--sbom=true \
|
||||
--provenance=true \
|
||||
--push \
|
||||
.
|
||||
$(MAKE) scan
|
||||
|
||||
scan:
|
||||
docker scout cves $(IMAGE_NAME):latest --only-severity critical,high || true
|
||||
@echo "⚠️ Review High/Critical vulnerability findings above."
|
||||
890
package-lock.json
generated
890
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -144,8 +144,8 @@
|
||||
"jsesc": "^3.0.2",
|
||||
"json5": "^2.2.3",
|
||||
"jsonata": "^2.0.3",
|
||||
"jsonpath-plus": "^9.0.0",
|
||||
"jsonwebtoken": "^9.0.2",
|
||||
"jsonpath-plus": "^10.3.0",
|
||||
"jsonwebtoken": "9.0.0",
|
||||
"jsqr": "^1.4.0",
|
||||
"jsrsasign": "^11.1.0",
|
||||
"kbpgp": "2.1.15",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user