Skip to content

Commit 75c65a9

Browse files
authored
Merge pull request #458 from anarkiwi/plat
matrix buildx by tool.
2 parents 44d8ed7 + 1cf5cef commit 75c65a9

File tree

5 files changed

+43
-24
lines changed

5 files changed

+43
-24
lines changed

.github/workflows/docker.yml

+28-20
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,31 @@ on:
99

1010
jobs:
1111
buildx:
12-
1312
runs-on: ubuntu-latest
14-
13+
strategy:
14+
matrix:
15+
include:
16+
# tools are build in order, for dependencies.
17+
- name: "rbqwrapped tools (p0f only)"
18+
tools: "rbqwrapper p0f"
19+
- name: pcap_to_node_pcap
20+
tools: "pcap_to_node_pcap"
21+
- name: tcprewrite_dot1q
22+
tools: "tcprewrite_dot1q"
23+
- name: ncapture
24+
tools: "network_tap/ncapture"
25+
- name: network_tap
26+
tools: "network_tap"
27+
- name: mercury
28+
tools: "mercury"
29+
- name: pcap_stats
30+
tools: "pcap_stats"
31+
- name: snort
32+
tools: "snort"
1533
steps:
1634
- uses: actions/checkout@v2
1735
with:
1836
fetch-depth: 0
19-
- name: Define list of images to build
20-
id: get_images
21-
run: |
22-
echo ::set-output name=NAMES::${NAMES}
23-
env:
24-
NAMES: rbqwrapper pcap_to_node_pcap tcprewrite_dot1q network_tap/ncapture network_tap p0f mercury pcap_stats snort
2537
- name: Get version number
2638
id: get_version
2739
run: |
@@ -76,11 +88,9 @@ jobs:
7688
VERSION: ${{ steps.get_version.outputs.VERSION }}
7789
- name: Test building only
7890
run: |
79-
for N in ${{ steps.get_images.outputs.NAMES }}
80-
do
81-
TAGGED_IMAGE="${{ secrets.DOCKER_NAMESPACE }}/$(basename ${N}):${{ steps.publish_tag.outputs.TAG }}"
82-
docker build \
83-
-t ${TAGGED_IMAGE} -f ${N}/Dockerfile .
91+
for tool in ${{ matrix.tools }} ; do
92+
TAGGED_IMAGE="${{ secrets.DOCKER_NAMESPACE }}/$(basename ${tool}):${{ steps.publish_tag.outputs.TAG }}"
93+
docker build -t ${TAGGED_IMAGE} -f "${tool}/Dockerfile" .
8494
done
8595
if: steps.docker.outputs.PUSH_TO_DOCKER == 'false'
8696
- name: Set up qemu
@@ -103,22 +113,20 @@ jobs:
103113
env:
104114
DOCKER_CLI_EXPERIMENTAL: enabled
105115
run: |
106-
for N in ${{ steps.get_images.outputs.NAMES }}
107-
do
108-
TAGGED_IMAGE="${{ secrets.DOCKER_NAMESPACE }}/$(basename ${N}):${{ steps.publish_tag.outputs.TAG }}"
116+
for tool in ${{ matrix.tools }} ; do
117+
TAGGED_IMAGE="${{ secrets.DOCKER_NAMESPACE }}/$(basename ${tool}):${{ steps.publish_tag.outputs.TAG }}"
109118
docker buildx build \
110119
--platform linux/amd64,linux/arm/v7,linux/arm64 \
111120
--push \
112-
-t ${TAGGED_IMAGE} -f ${N}/Dockerfile .
121+
-t ${TAGGED_IMAGE} -f "${tool}/Dockerfile" .
113122
done
114123
if: success() && (steps.docker.outputs.PUSH_TO_DOCKER == 'true')
115124
- name: List available tags for images
116125
env:
117126
DOCKER_CLI_EXPERIMENTAL: enabled
118127
run: |
119-
for N in ${{ steps.get_images.outputs.NAMES }}
120-
do
121-
image="${{ secrets.DOCKER_NAMESPACE }}/$(basename ${N})"
128+
for tool in ${{ matrix.tools }} ; do
129+
image="${{ secrets.DOCKER_NAMESPACE }}/$(basename ${tool})"
122130
echo "${image}:" $(
123131
wget -q https://registry.hub.docker.com/v1/repositories/${image}/tags -O - |
124132
tr -d '[]" ' |

snort/Dockerfile

+4-2
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,14 @@ RUN apt-get update && \
2828
unzip && \
2929
apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
3030
COPY snort/downloadhelper.sh /opt/downloadhelper.sh
31+
# hadolint ignore=DL3010
32+
COPY snort/*.tar.gz /opt/
3133
WORKDIR /opt
32-
RUN /opt/downloadhelper.sh https://www.snort.org/downloads/snort/daq-${DAQ_VERSION}.tar.gz daq.tgz && tar zxvf daq.tgz && mv daq-${DAQ_VERSION} daq && rm daq.tgz
34+
RUN /opt/downloadhelper.sh https://www.snort.org/downloads/snort/daq-${DAQ_VERSION}.tar.gz daq-${DAQ_VERSION}.tar.gz && tar zxvf daq-${DAQ_VERSION}.tar.gz && mv daq-${DAQ_VERSION} daq && rm daq-${DAQ_VERSION}.tar.gz
3335
WORKDIR /opt/daq
3436
RUN autoreconf -f -i && ./configure && make && make install
3537
WORKDIR /opt
36-
RUN /opt/downloadhelper.sh https://www.snort.org/downloads/snort/snort-${SNORT_VERSION}.tar.gz snort.tgz && tar zxvf snort.tgz && mv snort-${SNORT_VERSION} snort && rm snort.tgz
38+
RUN /opt/downloadhelper.sh https://www.snort.org/downloads/snort/snort-${SNORT_VERSION}.tar.gz snort-${SNORT_VERSION}.tar.gz && tar zxvf snort-${SNORT_VERSION}.tar.gz && mv snort-${SNORT_VERSION} snort && rm snort-${SNORT_VERSION}.tar.gz
3739
WORKDIR /opt/snort
3840
RUN ./configure --disable-open-appid && make && make install
3941

snort/daq-2.0.7.tar.gz

503 KB
Binary file not shown.

snort/downloadhelper.sh

+11-2
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,23 @@ tarfile=$2
99
retries=5
1010
if [[ "$url" == "" || "$tarfile" == "" ]] ; then
1111
echo need URL and tarfile
12+
exit 1
13+
fi
14+
15+
if [[ -f "$tarfile" ]] ; then
16+
echo $tarfile exists, skipping download
17+
exit 0
1218
fi
1319

1420
i=0
1521
while [ $i -lt $retries ]; do
1622
i=$((i+1))
1723
rm -f $outfile
24+
# TODO: workaround curl segfault in getaddrinfo() handling redirect under qemu
25+
finalurl=$(curl -Ls -w %{url_effective} -o /dev/null $url)
26+
echo final URL: $finalurl
1827
# TODO: snort binary serving does not work with TLS 1.3
19-
curl -Lv $url --tlsv1.2 --tls-max 1.2 --output $tarfile --trace -
28+
curl -v "$finalurl" --tlsv1.2 --tls-max 1.2 --output $tarfile --trace -
2029
tar ztvf $tarfile
2130
tarstatus=$?
2231
if [[ -f "$tarfile" && $tarstatus -eq 0 ]] ; then
@@ -25,7 +34,7 @@ while [ $i -lt $retries ]; do
2534
break
2635
fi
2736
echo retrying....
28-
sleep 5
37+
sleep 60
2938
done
3039

3140
echo failed to download $tarfile.

snort/snort-2.9.18.tar.gz

6.59 MB
Binary file not shown.

0 commit comments

Comments
 (0)