Skip to content

Commit

Permalink
Merge pull request #454 from Security-Onion-Solutions/2.4/endpoint-regex
Browse files Browse the repository at this point in the history
Refactor regex for endpoint and beta releases
  • Loading branch information
defensivedepth authored Sep 21, 2023
2 parents cf402c9 + 1dcdda5 commit dfac866
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions so-elastic-fleet-package-registry/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,11 @@ ARG VERSION
FROM docker.elastic.co/package-registry/distribution:$VERSION as original_image

# Cleanup unneeded packages, keeping the two most recent versons of each one
# Except for endpoint packages, keep all versions
RUN cd /packages/package-storage/ \
&& rm -rf suricata-* zeek-* snort-* dga-* endpoint*preview* endpoint*dev* endpoint*next* \
&& cd /packages/package-storage/ && LIST=$(ls | awk -F'[-]' '{print $1}' | sort | uniq ) \
&& for item in $LIST; do ls $item-*.zip | cut -d '-' -f 2 | tr - \~ | sort -V | tr \~ - | head -n-2 | xargs -I {} echo "$item-"{} | xargs rm -r; done
&& rm -rf suricata-* zeek-* snort-* dga-* endpoint*dev* endpoint*next* *preview* *beta* \
&& cd /packages/package-storage/ && LIST=$(ls --ignore="endpoint-*" | awk -F'[-]' '{print $1}' | sort | uniq ) \
&& for item in $LIST; do ls $item-*.zip | cut -d '-' -f 2 | tr - \~ | sort -V | tr \~ - | head -n-2 | xargs -I {} echo "$item-"{} | xargs -r rm -fr; done

FROM scratch

Expand Down

0 comments on commit dfac866

Please sign in to comment.