From 6b359c73582e649b8d8516c04b090c9c6ebe1ec5 Mon Sep 17 00:00:00 2001 From: Seth Grover Date: Tue, 7 May 2024 15:38:34 -0600 Subject: [PATCH] Explicitly define target platform for building images (idaholab/Malcolm#389) --- .github/workflows/api-build-and-push-ghcr.yml | 3 ++- .github/workflows/arkime-build-and-push-ghcr.yml | 3 ++- .github/workflows/dashboards-build-and-push-ghcr.yml | 3 ++- .github/workflows/dashboards-helper-build-and-push-ghcr.yml | 3 ++- .github/workflows/dirinit-build-and-push-ghcr.yml | 3 ++- .github/workflows/file-monitor-build-and-push-ghcr.yml | 3 ++- .github/workflows/file-upload-build-and-push-ghcr.yml | 3 ++- .github/workflows/filebeat-build-and-push-ghcr.yml | 3 ++- .github/workflows/freq-build-and-push-ghcr.yml | 3 ++- .github/workflows/htadmin-build-and-push-ghcr.yml | 3 ++- .github/workflows/logstash-build-and-push-ghcr.yml | 3 ++- .github/workflows/netbox-build-and-push-ghcr.yml | 3 ++- .github/workflows/nginx-build-and-push-ghcr.yml | 3 ++- .github/workflows/opensearch-build-and-push-ghcr.yml | 3 ++- .github/workflows/pcap-capture-build-and-push-ghcr.yml | 3 ++- .github/workflows/pcap-monitor-build-and-push-ghcr.yml | 3 ++- .github/workflows/postgresql-build-and-push-ghcr.yml | 3 ++- .github/workflows/redis-build-and-push-ghcr.yml | 3 ++- .github/workflows/suricata-build-and-push-ghcr.yml | 3 ++- .github/workflows/zeek-build-and-push-ghcr.yml | 3 ++- Dockerfiles/api.Dockerfile | 6 ++++-- Dockerfiles/arkime.Dockerfile | 6 ++++-- Dockerfiles/dashboards-helper.Dockerfile | 4 +++- Dockerfiles/dashboards.Dockerfile | 4 +++- Dockerfiles/dirinit.Dockerfile | 4 +++- Dockerfiles/file-monitor.Dockerfile | 4 +++- Dockerfiles/file-upload.Dockerfile | 6 ++++-- Dockerfiles/filebeat.Dockerfile | 4 +++- Dockerfiles/freq.Dockerfile | 4 +++- Dockerfiles/htadmin.Dockerfile | 4 +++- Dockerfiles/logstash.Dockerfile | 4 +++- Dockerfiles/netbox.Dockerfile | 4 +++- Dockerfiles/nginx.Dockerfile | 5 +++-- Dockerfiles/opensearch.Dockerfile | 4 +++- Dockerfiles/pcap-capture.Dockerfile | 4 +++- Dockerfiles/pcap-monitor.Dockerfile | 4 +++- Dockerfiles/postgresql.Dockerfile | 4 +++- Dockerfiles/redis.Dockerfile | 4 +++- Dockerfiles/suricata.Dockerfile | 5 ++++- Dockerfiles/zeek.Dockerfile | 5 +++-- scripts/build.sh | 6 ++++-- 41 files changed, 108 insertions(+), 47 deletions(-) diff --git a/.github/workflows/api-build-and-push-ghcr.yml b/.github/workflows/api-build-and-push-ghcr.yml index 8e0eae455..b626f516a 100644 --- a/.github/workflows/api-build-and-push-ghcr.yml +++ b/.github/workflows/api-build-and-push-ghcr.yml @@ -37,7 +37,7 @@ jobs: matrix: platform: - linux/amd64 - # - linux/arm64 + - linux/arm64 steps: - name: Cancel previous run in progress @@ -95,6 +95,7 @@ jobs: context: . file: ./Dockerfiles/api.Dockerfile build-args: | + TARGETPLATFORM=${{ matrix.platform }} MALCOLM_VERSION=${{ steps.extract_malcolm_version.outputs.mversion }} BUILD_DATE=${{ steps.generate_build_timestamp.outputs.btimestamp }} VCS_REVISION=${{ steps.extract_commit_sha.outputs.sha }} diff --git a/.github/workflows/arkime-build-and-push-ghcr.yml b/.github/workflows/arkime-build-and-push-ghcr.yml index fc8828bdc..a39e68e29 100644 --- a/.github/workflows/arkime-build-and-push-ghcr.yml +++ b/.github/workflows/arkime-build-and-push-ghcr.yml @@ -37,7 +37,7 @@ jobs: matrix: platform: - linux/amd64 - # - linux/arm64 + - linux/arm64 steps: - name: Cancel previous run in progress @@ -95,6 +95,7 @@ jobs: context: . file: ./Dockerfiles/arkime.Dockerfile build-args: | + TARGETPLATFORM=${{ matrix.platform }} MALCOLM_VERSION=${{ steps.extract_malcolm_version.outputs.mversion }} BUILD_DATE=${{ steps.generate_build_timestamp.outputs.btimestamp }} VCS_REVISION=${{ steps.extract_commit_sha.outputs.sha }} diff --git a/.github/workflows/dashboards-build-and-push-ghcr.yml b/.github/workflows/dashboards-build-and-push-ghcr.yml index a5090f563..e72deabe3 100644 --- a/.github/workflows/dashboards-build-and-push-ghcr.yml +++ b/.github/workflows/dashboards-build-and-push-ghcr.yml @@ -37,7 +37,7 @@ jobs: matrix: platform: - linux/amd64 - # - linux/arm64 + - linux/arm64 steps: - name: Cancel previous run in progress @@ -95,6 +95,7 @@ jobs: context: . file: ./Dockerfiles/dashboards.Dockerfile build-args: | + TARGETPLATFORM=${{ matrix.platform }} MALCOLM_VERSION=${{ steps.extract_malcolm_version.outputs.mversion }} BUILD_DATE=${{ steps.generate_build_timestamp.outputs.btimestamp }} VCS_REVISION=${{ steps.extract_commit_sha.outputs.sha }} diff --git a/.github/workflows/dashboards-helper-build-and-push-ghcr.yml b/.github/workflows/dashboards-helper-build-and-push-ghcr.yml index 7a8da0e01..ec81a8951 100644 --- a/.github/workflows/dashboards-helper-build-and-push-ghcr.yml +++ b/.github/workflows/dashboards-helper-build-and-push-ghcr.yml @@ -37,7 +37,7 @@ jobs: matrix: platform: - linux/amd64 - # - linux/arm64 + - linux/arm64 steps: - name: Cancel previous run in progress @@ -95,6 +95,7 @@ jobs: context: . file: ./Dockerfiles/dashboards-helper.Dockerfile build-args: | + TARGETPLATFORM=${{ matrix.platform }} MALCOLM_VERSION=${{ steps.extract_malcolm_version.outputs.mversion }} BUILD_DATE=${{ steps.generate_build_timestamp.outputs.btimestamp }} VCS_REVISION=${{ steps.extract_commit_sha.outputs.sha }} diff --git a/.github/workflows/dirinit-build-and-push-ghcr.yml b/.github/workflows/dirinit-build-and-push-ghcr.yml index 13a04a08f..264dfebd0 100644 --- a/.github/workflows/dirinit-build-and-push-ghcr.yml +++ b/.github/workflows/dirinit-build-and-push-ghcr.yml @@ -25,7 +25,7 @@ jobs: matrix: platform: - linux/amd64 - # - linux/arm64 + - linux/arm64 steps: - name: Cancel previous run in progress @@ -83,6 +83,7 @@ jobs: context: . file: ./Dockerfiles/dirinit.Dockerfile build-args: | + TARGETPLATFORM=${{ matrix.platform }} MALCOLM_VERSION=${{ steps.extract_malcolm_version.outputs.mversion }} BUILD_DATE=${{ steps.generate_build_timestamp.outputs.btimestamp }} VCS_REVISION=${{ steps.extract_commit_sha.outputs.sha }} diff --git a/.github/workflows/file-monitor-build-and-push-ghcr.yml b/.github/workflows/file-monitor-build-and-push-ghcr.yml index aa54d0696..626c946be 100644 --- a/.github/workflows/file-monitor-build-and-push-ghcr.yml +++ b/.github/workflows/file-monitor-build-and-push-ghcr.yml @@ -35,7 +35,7 @@ jobs: matrix: platform: - linux/amd64 - # - linux/arm64 + - linux/arm64 steps: - name: Cancel previous run in progress @@ -93,6 +93,7 @@ jobs: context: . file: ./Dockerfiles/file-monitor.Dockerfile build-args: | + TARGETPLATFORM=${{ matrix.platform }} MALCOLM_VERSION=${{ steps.extract_malcolm_version.outputs.mversion }} BUILD_DATE=${{ steps.generate_build_timestamp.outputs.btimestamp }} VCS_REVISION=${{ steps.extract_commit_sha.outputs.sha }} diff --git a/.github/workflows/file-upload-build-and-push-ghcr.yml b/.github/workflows/file-upload-build-and-push-ghcr.yml index 8afe48d2f..29fe71d1e 100644 --- a/.github/workflows/file-upload-build-and-push-ghcr.yml +++ b/.github/workflows/file-upload-build-and-push-ghcr.yml @@ -37,7 +37,7 @@ jobs: matrix: platform: - linux/amd64 - # - linux/arm64 + - linux/arm64 steps: - name: Cancel previous run in progress @@ -95,6 +95,7 @@ jobs: context: . file: ./Dockerfiles/file-upload.Dockerfile build-args: | + TARGETPLATFORM=${{ matrix.platform }} MALCOLM_VERSION=${{ steps.extract_malcolm_version.outputs.mversion }} BUILD_DATE=${{ steps.generate_build_timestamp.outputs.btimestamp }} VCS_REVISION=${{ steps.extract_commit_sha.outputs.sha }} diff --git a/.github/workflows/filebeat-build-and-push-ghcr.yml b/.github/workflows/filebeat-build-and-push-ghcr.yml index 38470a42d..1f01f36a8 100644 --- a/.github/workflows/filebeat-build-and-push-ghcr.yml +++ b/.github/workflows/filebeat-build-and-push-ghcr.yml @@ -37,7 +37,7 @@ jobs: matrix: platform: - linux/amd64 - # - linux/arm64 + - linux/arm64 steps: - name: Cancel previous run in progress @@ -95,6 +95,7 @@ jobs: context: . file: ./Dockerfiles/filebeat.Dockerfile build-args: | + TARGETPLATFORM=${{ matrix.platform }} MALCOLM_VERSION=${{ steps.extract_malcolm_version.outputs.mversion }} BUILD_DATE=${{ steps.generate_build_timestamp.outputs.btimestamp }} VCS_REVISION=${{ steps.extract_commit_sha.outputs.sha }} diff --git a/.github/workflows/freq-build-and-push-ghcr.yml b/.github/workflows/freq-build-and-push-ghcr.yml index 58c6315af..f9cda6632 100644 --- a/.github/workflows/freq-build-and-push-ghcr.yml +++ b/.github/workflows/freq-build-and-push-ghcr.yml @@ -37,7 +37,7 @@ jobs: matrix: platform: - linux/amd64 - # - linux/arm64 + - linux/arm64 steps: - name: Cancel previous run in progress @@ -95,6 +95,7 @@ jobs: context: . file: ./Dockerfiles/freq.Dockerfile build-args: | + TARGETPLATFORM=${{ matrix.platform }} MALCOLM_VERSION=${{ steps.extract_malcolm_version.outputs.mversion }} BUILD_DATE=${{ steps.generate_build_timestamp.outputs.btimestamp }} VCS_REVISION=${{ steps.extract_commit_sha.outputs.sha }} diff --git a/.github/workflows/htadmin-build-and-push-ghcr.yml b/.github/workflows/htadmin-build-and-push-ghcr.yml index 9ca98e632..ef7870dfe 100644 --- a/.github/workflows/htadmin-build-and-push-ghcr.yml +++ b/.github/workflows/htadmin-build-and-push-ghcr.yml @@ -37,7 +37,7 @@ jobs: matrix: platform: - linux/amd64 - # - linux/arm64 + - linux/arm64 steps: - name: Cancel previous run in progress @@ -95,6 +95,7 @@ jobs: context: . file: ./Dockerfiles/htadmin.Dockerfile build-args: | + TARGETPLATFORM=${{ matrix.platform }} MALCOLM_VERSION=${{ steps.extract_malcolm_version.outputs.mversion }} BUILD_DATE=${{ steps.generate_build_timestamp.outputs.btimestamp }} VCS_REVISION=${{ steps.extract_commit_sha.outputs.sha }} diff --git a/.github/workflows/logstash-build-and-push-ghcr.yml b/.github/workflows/logstash-build-and-push-ghcr.yml index c0d11d8da..9113a6b58 100644 --- a/.github/workflows/logstash-build-and-push-ghcr.yml +++ b/.github/workflows/logstash-build-and-push-ghcr.yml @@ -37,7 +37,7 @@ jobs: matrix: platform: - linux/amd64 - # - linux/arm64 + - linux/arm64 steps: - name: Cancel previous run in progress @@ -95,6 +95,7 @@ jobs: context: . file: ./Dockerfiles/logstash.Dockerfile build-args: | + TARGETPLATFORM=${{ matrix.platform }} MALCOLM_VERSION=${{ steps.extract_malcolm_version.outputs.mversion }} BUILD_DATE=${{ steps.generate_build_timestamp.outputs.btimestamp }} VCS_REVISION=${{ steps.extract_commit_sha.outputs.sha }} diff --git a/.github/workflows/netbox-build-and-push-ghcr.yml b/.github/workflows/netbox-build-and-push-ghcr.yml index 90e193c7d..42f4af73a 100644 --- a/.github/workflows/netbox-build-and-push-ghcr.yml +++ b/.github/workflows/netbox-build-and-push-ghcr.yml @@ -37,7 +37,7 @@ jobs: matrix: platform: - linux/amd64 - # - linux/arm64 + - linux/arm64 steps: - name: Cancel previous run in progress @@ -95,6 +95,7 @@ jobs: context: . file: ./Dockerfiles/netbox.Dockerfile build-args: | + TARGETPLATFORM=${{ matrix.platform }} MALCOLM_VERSION=${{ steps.extract_malcolm_version.outputs.mversion }} BUILD_DATE=${{ steps.generate_build_timestamp.outputs.btimestamp }} VCS_REVISION=${{ steps.extract_commit_sha.outputs.sha }} diff --git a/.github/workflows/nginx-build-and-push-ghcr.yml b/.github/workflows/nginx-build-and-push-ghcr.yml index e2c127f98..f158001ba 100644 --- a/.github/workflows/nginx-build-and-push-ghcr.yml +++ b/.github/workflows/nginx-build-and-push-ghcr.yml @@ -43,7 +43,7 @@ jobs: matrix: platform: - linux/amd64 - # - linux/arm64 + - linux/arm64 steps: - name: Cancel previous run in progress @@ -101,6 +101,7 @@ jobs: context: . file: ./Dockerfiles/nginx.Dockerfile build-args: | + TARGETPLATFORM=${{ matrix.platform }} MALCOLM_VERSION=${{ steps.extract_malcolm_version.outputs.mversion }} BUILD_DATE=${{ steps.generate_build_timestamp.outputs.btimestamp }} VCS_REVISION=${{ steps.extract_commit_sha.outputs.sha }} diff --git a/.github/workflows/opensearch-build-and-push-ghcr.yml b/.github/workflows/opensearch-build-and-push-ghcr.yml index 21885903b..d644f4616 100644 --- a/.github/workflows/opensearch-build-and-push-ghcr.yml +++ b/.github/workflows/opensearch-build-and-push-ghcr.yml @@ -36,7 +36,7 @@ jobs: matrix: platform: - linux/amd64 - # - linux/arm64 + - linux/arm64 steps: - name: Cancel previous run in progress @@ -94,6 +94,7 @@ jobs: context: . file: ./Dockerfiles/opensearch.Dockerfile build-args: | + TARGETPLATFORM=${{ matrix.platform }} MALCOLM_VERSION=${{ steps.extract_malcolm_version.outputs.mversion }} BUILD_DATE=${{ steps.generate_build_timestamp.outputs.btimestamp }} VCS_REVISION=${{ steps.extract_commit_sha.outputs.sha }} diff --git a/.github/workflows/pcap-capture-build-and-push-ghcr.yml b/.github/workflows/pcap-capture-build-and-push-ghcr.yml index ad5e8f8d7..25e85bfd2 100644 --- a/.github/workflows/pcap-capture-build-and-push-ghcr.yml +++ b/.github/workflows/pcap-capture-build-and-push-ghcr.yml @@ -37,7 +37,7 @@ jobs: matrix: platform: - linux/amd64 - # - linux/arm64 + - linux/arm64 steps: - name: Cancel previous run in progress @@ -95,6 +95,7 @@ jobs: context: . file: ./Dockerfiles/pcap-capture.Dockerfile build-args: | + TARGETPLATFORM=${{ matrix.platform }} MALCOLM_VERSION=${{ steps.extract_malcolm_version.outputs.mversion }} BUILD_DATE=${{ steps.generate_build_timestamp.outputs.btimestamp }} VCS_REVISION=${{ steps.extract_commit_sha.outputs.sha }} diff --git a/.github/workflows/pcap-monitor-build-and-push-ghcr.yml b/.github/workflows/pcap-monitor-build-and-push-ghcr.yml index d2ebe922c..488ea85bf 100644 --- a/.github/workflows/pcap-monitor-build-and-push-ghcr.yml +++ b/.github/workflows/pcap-monitor-build-and-push-ghcr.yml @@ -37,7 +37,7 @@ jobs: matrix: platform: - linux/amd64 - # - linux/arm64 + - linux/arm64 steps: - name: Cancel previous run in progress @@ -95,6 +95,7 @@ jobs: context: . file: ./Dockerfiles/pcap-monitor.Dockerfile build-args: | + TARGETPLATFORM=${{ matrix.platform }} MALCOLM_VERSION=${{ steps.extract_malcolm_version.outputs.mversion }} BUILD_DATE=${{ steps.generate_build_timestamp.outputs.btimestamp }} VCS_REVISION=${{ steps.extract_commit_sha.outputs.sha }} diff --git a/.github/workflows/postgresql-build-and-push-ghcr.yml b/.github/workflows/postgresql-build-and-push-ghcr.yml index 71c1f812c..dd82ee36e 100644 --- a/.github/workflows/postgresql-build-and-push-ghcr.yml +++ b/.github/workflows/postgresql-build-and-push-ghcr.yml @@ -36,7 +36,7 @@ jobs: matrix: platform: - linux/amd64 - # - linux/arm64 + - linux/arm64 steps: - name: Cancel previous run in progress @@ -94,6 +94,7 @@ jobs: context: . file: ./Dockerfiles/postgresql.Dockerfile build-args: | + TARGETPLATFORM=${{ matrix.platform }} MALCOLM_VERSION=${{ steps.extract_malcolm_version.outputs.mversion }} BUILD_DATE=${{ steps.generate_build_timestamp.outputs.btimestamp }} VCS_REVISION=${{ steps.extract_commit_sha.outputs.sha }} diff --git a/.github/workflows/redis-build-and-push-ghcr.yml b/.github/workflows/redis-build-and-push-ghcr.yml index 79e22dced..1dc2f8c9f 100644 --- a/.github/workflows/redis-build-and-push-ghcr.yml +++ b/.github/workflows/redis-build-and-push-ghcr.yml @@ -36,7 +36,7 @@ jobs: matrix: platform: - linux/amd64 - # - linux/arm64 + - linux/arm64 steps: - name: Cancel previous run in progress @@ -94,6 +94,7 @@ jobs: context: . file: ./Dockerfiles/redis.Dockerfile build-args: | + TARGETPLATFORM=${{ matrix.platform }} MALCOLM_VERSION=${{ steps.extract_malcolm_version.outputs.mversion }} BUILD_DATE=${{ steps.generate_build_timestamp.outputs.btimestamp }} VCS_REVISION=${{ steps.extract_commit_sha.outputs.sha }} diff --git a/.github/workflows/suricata-build-and-push-ghcr.yml b/.github/workflows/suricata-build-and-push-ghcr.yml index 46941c01e..2d548b2bc 100644 --- a/.github/workflows/suricata-build-and-push-ghcr.yml +++ b/.github/workflows/suricata-build-and-push-ghcr.yml @@ -36,7 +36,7 @@ jobs: matrix: platform: - linux/amd64 - # - linux/arm64 + - linux/arm64 steps: - name: Cancel previous run in progress @@ -94,6 +94,7 @@ jobs: context: . file: ./Dockerfiles/suricata.Dockerfile build-args: | + TARGETPLATFORM=${{ matrix.platform }} MALCOLM_VERSION=${{ steps.extract_malcolm_version.outputs.mversion }} BUILD_DATE=${{ steps.generate_build_timestamp.outputs.btimestamp }} VCS_REVISION=${{ steps.extract_commit_sha.outputs.sha }} diff --git a/.github/workflows/zeek-build-and-push-ghcr.yml b/.github/workflows/zeek-build-and-push-ghcr.yml index d9fbd6c4c..7b7a8f99e 100644 --- a/.github/workflows/zeek-build-and-push-ghcr.yml +++ b/.github/workflows/zeek-build-and-push-ghcr.yml @@ -36,7 +36,7 @@ jobs: matrix: platform: - linux/amd64 - # - linux/arm64 + - linux/arm64 steps: - name: Cancel previous run in progress @@ -95,6 +95,7 @@ jobs: file: ./Dockerfiles/zeek.Dockerfile build-args: | BUILD_JOBS=2 + TARGETPLATFORM=${{ matrix.platform }} MALCOLM_VERSION=${{ steps.extract_malcolm_version.outputs.mversion }} BUILD_DATE=${{ steps.generate_build_timestamp.outputs.btimestamp }} VCS_REVISION=${{ steps.extract_commit_sha.outputs.sha }} diff --git a/Dockerfiles/api.Dockerfile b/Dockerfiles/api.Dockerfile index b7fbfdfd6..266dd1f20 100644 --- a/Dockerfiles/api.Dockerfile +++ b/Dockerfiles/api.Dockerfile @@ -1,4 +1,6 @@ -FROM python:3-slim-bookworm as builder +ARG TARGETPLATFORM=linux/amd64 + +FROM --platform=${TARGETPLATFORM} python:3-slim-bookworm as builder ENV DEBIAN_FRONTEND noninteractive ENV TERM xterm @@ -18,7 +20,7 @@ WORKDIR /usr/src/app RUN python3 -m pip wheel --no-cache-dir --no-deps --wheel-dir /usr/src/app/wheels -r requirements.txt \ && flake8 --ignore=E203,E501,F401,W503 -FROM python:3-slim-bookworm +FROM --platform=${TARGETPLATFORM} python:3-slim-bookworm # Copyright (c) 2024 Battelle Energy Alliance, LLC. All rights reserved. LABEL maintainer="malcolm@inl.gov" diff --git a/Dockerfiles/arkime.Dockerfile b/Dockerfiles/arkime.Dockerfile index f801ae0eb..1229d884f 100644 --- a/Dockerfiles/arkime.Dockerfile +++ b/Dockerfiles/arkime.Dockerfile @@ -1,4 +1,6 @@ -FROM debian:12-slim AS build +ARG TARGETPLATFORM=linux/amd64 + +FROM --platform=${TARGETPLATFORM} debian:12-slim AS build # Copyright (c) 2024 Battelle Energy Alliance, LLC. All rights reserved. @@ -79,7 +81,7 @@ RUN export DEBARCH=$(dpkg --print-architecture) && \ curl -fsSL -o "${ARKIME_DIR}/plugins/ja4plus.${DEBARCH}.so" "https://github.com/arkime/arkime/releases/download/${ARKIME_VERSION}/ja4plus.${DEBARCH}.so" && \ chmod 755 "${ARKIME_DIR}/plugins/ja4plus.${DEBARCH}.so" -FROM debian:12-slim +FROM --platform=${TARGETPLATFORM} debian:12-slim LABEL maintainer="malcolm@inl.gov" LABEL org.opencontainers.image.authors='malcolm@inl.gov' diff --git a/Dockerfiles/dashboards-helper.Dockerfile b/Dockerfiles/dashboards-helper.Dockerfile index babbb14ff..af155bc9d 100644 --- a/Dockerfiles/dashboards-helper.Dockerfile +++ b/Dockerfiles/dashboards-helper.Dockerfile @@ -1,4 +1,6 @@ -FROM alpine:3.19 +ARG TARGETPLATFORM=linux/amd64 + +FROM --platform=${TARGETPLATFORM} alpine:3.19 # Copyright (c) 2020 Battelle Energy Alliance, LLC. All rights reserved. LABEL maintainer="malcolm@inl.gov" diff --git a/Dockerfiles/dashboards.Dockerfile b/Dockerfiles/dashboards.Dockerfile index 7e0b7ebed..9792e07de 100644 --- a/Dockerfiles/dashboards.Dockerfile +++ b/Dockerfiles/dashboards.Dockerfile @@ -1,4 +1,6 @@ -FROM opensearchproject/opensearch-dashboards:2.13.0 +ARG TARGETPLATFORM=linux/amd64 + +FROM --platform=${TARGETPLATFORM} opensearchproject/opensearch-dashboards:2.13.0 LABEL maintainer="malcolm@inl.gov" LABEL org.opencontainers.image.authors='malcolm@inl.gov' diff --git a/Dockerfiles/dirinit.Dockerfile b/Dockerfiles/dirinit.Dockerfile index 0e8998c61..ea383b975 100644 --- a/Dockerfiles/dirinit.Dockerfile +++ b/Dockerfiles/dirinit.Dockerfile @@ -1,4 +1,6 @@ -FROM alpine:3.19 +ARG TARGETPLATFORM=linux/amd64 + +FROM --platform=${TARGETPLATFORM} alpine:3.19 # Copyright (c) 2024 Battelle Energy Alliance, LLC. All rights reserved. LABEL maintainer="malcolm@inl.gov" diff --git a/Dockerfiles/file-monitor.Dockerfile b/Dockerfiles/file-monitor.Dockerfile index 2d1f4d318..5495b1440 100644 --- a/Dockerfiles/file-monitor.Dockerfile +++ b/Dockerfiles/file-monitor.Dockerfile @@ -1,4 +1,6 @@ -FROM debian:12-slim +ARG TARGETPLATFORM=linux/amd64 + +FROM --platform=${TARGETPLATFORM} debian:12-slim # Copyright (c) 2024 Battelle Energy Alliance, LLC. All rights reserved. LABEL maintainer="malcolm@inl.gov" diff --git a/Dockerfiles/file-upload.Dockerfile b/Dockerfiles/file-upload.Dockerfile index c597b5c5d..1159b9420 100644 --- a/Dockerfiles/file-upload.Dockerfile +++ b/Dockerfiles/file-upload.Dockerfile @@ -1,4 +1,6 @@ -FROM debian:12-slim AS npmget +ARG TARGETPLATFORM=linux/amd64 + +FROM --platform=${TARGETPLATFORM} debian:12-slim AS npmget # Copyright (c) 2024 Battelle Energy Alliance, LLC. All rights reserved. @@ -15,7 +17,7 @@ RUN apt-get -q update && \ filepond-plugin-file-rename \ @jcubic/tagger -FROM debian:12-slim AS runtime +FROM --platform=${TARGETPLATFORM} debian:12-slim AS runtime LABEL maintainer="malcolm@inl.gov" LABEL org.opencontainers.image.authors='malcolm@inl.gov' diff --git a/Dockerfiles/filebeat.Dockerfile b/Dockerfiles/filebeat.Dockerfile index 233dc2a37..665a98363 100644 --- a/Dockerfiles/filebeat.Dockerfile +++ b/Dockerfiles/filebeat.Dockerfile @@ -1,4 +1,6 @@ -FROM docker.elastic.co/beats/filebeat-oss:8.13.3 +ARG TARGETPLATFORM=linux/amd64 + +FROM --platform=${TARGETPLATFORM} docker.elastic.co/beats/filebeat-oss:8.13.3 # Copyright (c) 2024 Battelle Energy Alliance, LLC. All rights reserved. LABEL maintainer="malcolm@inl.gov" diff --git a/Dockerfiles/freq.Dockerfile b/Dockerfiles/freq.Dockerfile index 3801f963c..7b4a5dcc4 100644 --- a/Dockerfiles/freq.Dockerfile +++ b/Dockerfiles/freq.Dockerfile @@ -1,4 +1,6 @@ -FROM debian:12-slim +ARG TARGETPLATFORM=linux/amd64 + +FROM --platform=${TARGETPLATFORM} debian:12-slim # Copyright (c) 2024 Battelle Energy Alliance, LLC. All rights reserved. LABEL maintainer="malcolm@inl.gov" diff --git a/Dockerfiles/htadmin.Dockerfile b/Dockerfiles/htadmin.Dockerfile index 82718df06..93b36ac32 100644 --- a/Dockerfiles/htadmin.Dockerfile +++ b/Dockerfiles/htadmin.Dockerfile @@ -1,4 +1,6 @@ -FROM debian:11-slim +ARG TARGETPLATFORM=linux/amd64 + +FROM --platform=${TARGETPLATFORM} debian:11-slim # Copyright (c) 2024 Battelle Energy Alliance, LLC. All rights reserved. LABEL maintainer="malcolm@inl.gov" diff --git a/Dockerfiles/logstash.Dockerfile b/Dockerfiles/logstash.Dockerfile index 9978dc3fd..b9c60ddcc 100644 --- a/Dockerfiles/logstash.Dockerfile +++ b/Dockerfiles/logstash.Dockerfile @@ -1,4 +1,6 @@ -FROM docker.elastic.co/logstash/logstash-oss:8.13.3 +ARG TARGETPLATFORM=linux/amd64 + +FROM --platform=${TARGETPLATFORM} docker.elastic.co/logstash/logstash-oss:8.13.3 LABEL maintainer="malcolm@inl.gov" LABEL org.opencontainers.image.authors='malcolm@inl.gov' diff --git a/Dockerfiles/netbox.Dockerfile b/Dockerfiles/netbox.Dockerfile index 391c7c238..a3d675ee3 100644 --- a/Dockerfiles/netbox.Dockerfile +++ b/Dockerfiles/netbox.Dockerfile @@ -1,4 +1,6 @@ -FROM netboxcommunity/netbox:v3.6.7 +ARG TARGETPLATFORM=linux/amd64 + +FROM --platform=${TARGETPLATFORM} netboxcommunity/netbox:v3.6.7 # Copyright (c) 2024 Battelle Energy Alliance, LLC. All rights reserved. LABEL maintainer="malcolm@inl.gov" diff --git a/Dockerfiles/nginx.Dockerfile b/Dockerfiles/nginx.Dockerfile index 4dd01ec0a..9638fd94e 100644 --- a/Dockerfiles/nginx.Dockerfile +++ b/Dockerfiles/nginx.Dockerfile @@ -6,9 +6,10 @@ # tiredofit/docker-nginx-ldap - https://github.com/tiredofit/docker-nginx-ldap/blob/master/Dockerfile #################################################################################### +ARG TARGETPLATFORM=linux/amd64 # first build documentation with jekyll -FROM ghcr.io/mmguero-dev/jekyll:latest as docbuild +FROM --platform=${TARGETPLATFORM} ghcr.io/mmguero-dev/jekyll:latest as docbuild ARG GITHUB_TOKEN ARG VCS_REVISION @@ -32,7 +33,7 @@ RUN find /site -type f -name "*.md" -exec sed -i "s/{{[[:space:]]*site.github.bu find /site/_site -type f -name "*.html" -exec sed -i 's@\(href=\)"/"@\1"/readme/"@g' "{}" \; # build NGINX image -FROM alpine:3.18 +FROM --platform=${TARGETPLATFORM} alpine:3.18 LABEL maintainer="malcolm@inl.gov" LABEL org.opencontainers.image.authors='malcolm@inl.gov' diff --git a/Dockerfiles/opensearch.Dockerfile b/Dockerfiles/opensearch.Dockerfile index f3c477967..72a288cf7 100644 --- a/Dockerfiles/opensearch.Dockerfile +++ b/Dockerfiles/opensearch.Dockerfile @@ -1,4 +1,6 @@ -FROM opensearchproject/opensearch:2.13.0 +ARG TARGETPLATFORM=linux/amd64 + +FROM --platform=${TARGETPLATFORM} opensearchproject/opensearch:2.13.0 # Copyright (c) 2024 Battelle Energy Alliance, LLC. All rights reserved. LABEL maintainer="malcolm@inl.gov" diff --git a/Dockerfiles/pcap-capture.Dockerfile b/Dockerfiles/pcap-capture.Dockerfile index 15cc1b528..dca9a6f36 100644 --- a/Dockerfiles/pcap-capture.Dockerfile +++ b/Dockerfiles/pcap-capture.Dockerfile @@ -1,4 +1,6 @@ -FROM debian:12-slim +ARG TARGETPLATFORM=linux/amd64 + +FROM --platform=${TARGETPLATFORM} debian:12-slim # Copyright (c) 2024 Battelle Energy Alliance, LLC. All rights reserved. LABEL maintainer="malcolm@inl.gov" diff --git a/Dockerfiles/pcap-monitor.Dockerfile b/Dockerfiles/pcap-monitor.Dockerfile index 6ec3c649b..9efa4aabb 100644 --- a/Dockerfiles/pcap-monitor.Dockerfile +++ b/Dockerfiles/pcap-monitor.Dockerfile @@ -1,4 +1,6 @@ -FROM debian:12-slim +ARG TARGETPLATFORM=linux/amd64 + +FROM --platform=${TARGETPLATFORM} debian:12-slim # Copyright (c) 2024 Battelle Energy Alliance, LLC. All rights reserved. LABEL maintainer="malcolm@inl.gov" diff --git a/Dockerfiles/postgresql.Dockerfile b/Dockerfiles/postgresql.Dockerfile index 4f263abbb..6e7f81348 100644 --- a/Dockerfiles/postgresql.Dockerfile +++ b/Dockerfiles/postgresql.Dockerfile @@ -1,4 +1,6 @@ -FROM postgres:15-alpine +ARG TARGETPLATFORM=linux/amd64 + +FROM --platform=${TARGETPLATFORM} postgres:15-alpine # Copyright (c) 2024 Battelle Energy Alliance, LLC. All rights reserved. LABEL maintainer="malcolm@inl.gov" diff --git a/Dockerfiles/redis.Dockerfile b/Dockerfiles/redis.Dockerfile index 0e28fdf3d..09ccf00fe 100644 --- a/Dockerfiles/redis.Dockerfile +++ b/Dockerfiles/redis.Dockerfile @@ -1,4 +1,6 @@ -FROM redis:7-alpine +ARG TARGETPLATFORM=linux/amd64 + +FROM --platform=${TARGETPLATFORM} redis:7-alpine # Copyright (c) 2024 Battelle Energy Alliance, LLC. All rights reserved. LABEL maintainer="malcolm@inl.gov" diff --git a/Dockerfiles/suricata.Dockerfile b/Dockerfiles/suricata.Dockerfile index 4296b608b..ead11388d 100644 --- a/Dockerfiles/suricata.Dockerfile +++ b/Dockerfiles/suricata.Dockerfile @@ -1,5 +1,8 @@ -FROM debian:12-slim +ARG TARGETPLATFORM=linux/amd64 +FROM --platform=${TARGETPLATFORM} debian:12-slim + +# Copyright (c) 2024 Battelle Energy Alliance, LLC. All rights reserved. LABEL maintainer="malcolm@inl.gov" LABEL org.opencontainers.image.authors='malcolm@inl.gov' LABEL org.opencontainers.image.url='https://github.com/idaholab/Malcolm' diff --git a/Dockerfiles/zeek.Dockerfile b/Dockerfiles/zeek.Dockerfile index edb99ab3a..29c6e4412 100644 --- a/Dockerfiles/zeek.Dockerfile +++ b/Dockerfiles/zeek.Dockerfile @@ -1,7 +1,8 @@ -FROM debian:12-slim +ARG TARGETPLATFORM=linux/amd64 -# Copyright (c) 2024 Battelle Energy Alliance, LLC. All rights reserved. +FROM --platform=${TARGETPLATFORM} debian:12-slim +# Copyright (c) 2024 Battelle Energy Alliance, LLC. All rights reserved. LABEL maintainer="malcolm@inl.gov" LABEL org.opencontainers.image.authors='malcolm@inl.gov' LABEL org.opencontainers.image.url='https://github.com/idaholab/Malcolm' diff --git a/scripts/build.sh b/scripts/build.sh index 7b82f9289..38472bc38 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -75,6 +75,8 @@ unset CONFIRMATION read -p "Malcolm Docker images will now be built and/or pulled, force full clean (non-cached) rebuild [y/N]? " CONFIRMATION CONFIRMATION=${CONFIRMATION:-N} +# e.g., linux/amd64 or linux/arm64 +TARGET_PLATFORM=$(uname -s | tr '[:upper:]' '[:lower:]')/$(uname -m | sed 's/x86_64/amd64/' | sed 's/aarch64/arm64/') BUILD_DATE="$(date -u +'%Y-%m-%dT%H:%M:%SZ')" MALCOLM_VERSION="$($GREP -P "^\s+image:.*/malcolm/" "$CONFIG_FILE" | awk '{print $2}' | cut -d':' -f2 | uniq -c | sort -nr | awk '{print $2}' | head -n 1)" VCS_REVISION="$(git rev-parse --short HEAD 2>/dev/null || echo unknown)" @@ -99,9 +101,9 @@ fi # build the image(s) if [[ $CONFIRMATION =~ ^[Yy] ]]; then - $DOCKER_COMPOSE_COMMAND --progress=plain build --force-rm --no-cache --build-arg GITHUB_TOKEN="$GITHUB_API_TOKEN" --build-arg MAXMIND_GEOIP_DB_LICENSE_KEY="$MAXMIND_API_KEY" --build-arg BUILD_DATE="$BUILD_DATE" --build-arg MALCOLM_VERSION="$MALCOLM_VERSION" --build-arg VCS_REVISION="$VCS_REVISION" "$@" + $DOCKER_COMPOSE_COMMAND --progress=plain build --force-rm --no-cache --build-arg TARGETPLATFORM="$TARGET_PLATFORM" --build-arg GITHUB_TOKEN="$GITHUB_API_TOKEN" --build-arg MAXMIND_GEOIP_DB_LICENSE_KEY="$MAXMIND_API_KEY" --build-arg BUILD_DATE="$BUILD_DATE" --build-arg MALCOLM_VERSION="$MALCOLM_VERSION" --build-arg VCS_REVISION="$VCS_REVISION" "$@" else - $DOCKER_COMPOSE_COMMAND --progress=plain build --build-arg GITHUB_TOKEN="$GITHUB_API_TOKEN" --build-arg MAXMIND_GEOIP_DB_LICENSE_KEY="$MAXMIND_API_KEY" --build-arg BUILD_DATE="$BUILD_DATE" --build-arg MALCOLM_VERSION="$MALCOLM_VERSION" --build-arg VCS_REVISION="$VCS_REVISION" "$@" + $DOCKER_COMPOSE_COMMAND --progress=plain build --build-arg TARGETPLATFORM="$TARGET_PLATFORM" --build-arg GITHUB_TOKEN="$GITHUB_API_TOKEN" --build-arg MAXMIND_GEOIP_DB_LICENSE_KEY="$MAXMIND_API_KEY" --build-arg BUILD_DATE="$BUILD_DATE" --build-arg MALCOLM_VERSION="$MALCOLM_VERSION" --build-arg VCS_REVISION="$VCS_REVISION" "$@" fi # we're going to do some validation that some things got pulled/built correctly