php: Update phpredis and ssdeep extensions #565
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
name: Docker Image CI | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
workflow_dispatch: | |
inputs: | |
misp_ref: | |
description: 'MISP branch or tag to build' | |
required: true | |
default: 'develop' | |
env: | |
TEST_TAG: misp:latest | |
# See https://github.com/goodwithtech/dockle/issues/188 | |
DOCKLE_HOST: "unix:///var/run/docker.sock" | |
BUCKET_NAME: testbucket | |
MINIO_ACCESS_KEY: testuser | |
MINIO_SECRET_KEY: i5Qkesr8fbV0Vezn0zojaIyKvnObUtNMXFu38wlT | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
timeout-minutes: 60 | |
steps: | |
- | |
name: Checkout | |
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: Fetch variables | |
run: for v in $(python3 .github/workflows/docker-version.py ${{ github.event.inputs.misp_ref }}); do echo $v >> $GITHUB_ENV; done | |
id: variables | |
- | |
name: Cache Docker layers | |
uses: actions/cache@v4 | |
with: | |
path: /tmp/.buildx-cache | |
key: ${{ runner.os }}-buildx-${{ github.sha }} | |
restore-keys: | | |
${{ runner.os }}-buildx- | |
- | |
name: Build and export to Docker | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
load: true | |
tags: ${{ env.TEST_TAG }} | |
cache-from: type=local,src=/tmp/.buildx-cache/amd64 | |
cache-to: type=local,dest=/tmp/.buildx-cache-new/amd64,mode=max | |
build-args: | | |
CACHEBUST=${{ env.MISP_COMMIT }} | |
MISP_VERSION=${{ env.MISP_VERSION }} | |
- | |
name: Test | |
env: | |
BUCKET_NAME: ${{ env.BUCKET_NAME }} | |
S3_ACCESS_KEY: ${{ env.MINIO_ACCESS_KEY }} | |
S3_SECRET_KEY: ${{ env.MINIO_SECRET_KEY }} | |
run: | | |
cat .github/workflows/test/.test-env.sh >> ./.env_s3 | |
docker history ${{ env.TEST_TAG }} | |
MISP_IMAGE=${{ env.TEST_TAG }} docker compose up --detach --quiet-pull | |
sleep 15 # Wait until container is ready | |
docker logs misp | |
AUTHKEY=$(docker exec misp su-exec apache /var/www/MISP/app/Console/cake user init) | |
VERSION=$(curl --fail -v -H "Authorization: $AUTHKEY" -H "Accept: application/json" http://localhost:8080/servers/getVersion) | |
echo $VERSION | jq | |
.github/workflows/test/test_minio.sh $S3_ACCESS_KEY $S3_SECRET_KEY $BUCKET_NAME $AUTHKEY | |
docker restart misp # Also test restart | |
sleep 10 # Wait until container is ready | |
curl --fail -v -H "Authorization: $AUTHKEY" -H "Accept: application/json" http://localhost:8080/servers/getVersion | |
docker compose down | |
- | |
name: Build Docker for linux/arm64 | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
platforms: linux/arm64 | |
tags: ${{ env.TEST_TAG }} | |
cache-from: type=local,src=/tmp/.buildx-cache/arm64 | |
cache-to: type=local,dest=/tmp/.buildx-cache-new/arm64,mode=max | |
build-args: | | |
CACHEBUST=${{ env.MISP_COMMIT }} | |
MISP_VERSION=${{ env.MISP_VERSION }} | |
- | |
# Temp fix | |
# https://github.com/docker/build-push-action/issues/252 | |
# https://github.com/moby/buildkit/issues/1896 | |
name: Move cache | |
run: | | |
rm -rf /tmp/.buildx-cache | |
mv /tmp/.buildx-cache-new /tmp/.buildx-cache | |
du -sh /tmp/.buildx-cache | |
- | |
name: Login to GitHub Container Registry | |
if: github.event_name != 'pull_request' | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- | |
name: Login to DockerHub | |
if: github.event_name != 'pull_request' | |
uses: docker/login-action@v3 | |
with: | |
username: nukib | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- | |
name: Build and push | |
if: github.event_name != 'pull_request' | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
platforms: linux/amd64,linux/arm64 | |
push: true | |
tags: | | |
nukib/misp:latest | |
ghcr.io/nukib/misp:latest | |
build-args: | | |
CACHEBUST=${{ env.MISP_COMMIT }} | |
MISP_VERSION=${{ env.MISP_VERSION }} |