Compare commits
12 Commits
Author | SHA1 | Date | |
---|---|---|---|
0c758df2c2 | |||
1ed8bcbc31 | |||
01de5baae1 | |||
fda5aff7ef | |||
9d35570379 | |||
4894e1419c | |||
016f8e64f4 | |||
1ac07c5704 | |||
26a777f4df | |||
9fc98a1fd4 | |||
14a03309d3 | |||
d11a2a1666 |
@ -39,6 +39,7 @@ steps:
|
|||||||
when:
|
when:
|
||||||
event:
|
event:
|
||||||
- tag
|
- tag
|
||||||
|
- cron
|
||||||
|
|
||||||
---
|
---
|
||||||
kind: pipeline
|
kind: pipeline
|
||||||
@ -81,6 +82,7 @@ steps:
|
|||||||
when:
|
when:
|
||||||
event:
|
event:
|
||||||
- tag
|
- tag
|
||||||
|
- cron
|
||||||
|
|
||||||
---
|
---
|
||||||
kind: pipeline
|
kind: pipeline
|
||||||
@ -104,6 +106,7 @@ steps:
|
|||||||
trigger:
|
trigger:
|
||||||
event:
|
event:
|
||||||
- tag
|
- tag
|
||||||
|
- cron
|
||||||
|
|
||||||
depends_on:
|
depends_on:
|
||||||
- linux-amd64
|
- linux-amd64
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
---
|
||||||
name: Vulnerability Scan
|
name: Vulnerability Scan
|
||||||
|
|
||||||
on:
|
on:
|
||||||
@ -14,15 +15,24 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Pull docker image
|
- name: Pull docker image
|
||||||
run: docker pull docker.asperti.com/${{ github.repository_owner }}/hugo:latest
|
run: docker pull docker.asperti.com/paspo/hugo:latest
|
||||||
|
|
||||||
|
- name: Setup trivy
|
||||||
|
run: |
|
||||||
|
echo "Installing Trivy for arch: $(uname -m)"
|
||||||
|
case $(uname -m) in
|
||||||
|
x86_64)
|
||||||
|
wget -O /tmp/trivy.deb https://github.com/aquasecurity/trivy/releases/download/v0.58.2/trivy_0.58.2_Linux-64bit.deb ;;
|
||||||
|
aarch64)
|
||||||
|
wget -O /tmp/trivy.deb https://github.com/aquasecurity/trivy/releases/download/v0.58.2/trivy_0.58.2_Linux-ARM64.deb ;;
|
||||||
|
*) exit 1 ;;
|
||||||
|
esac
|
||||||
|
dpkg -i /tmp/trivy.deb
|
||||||
|
|
||||||
- name: Run Trivy vulnerability scanner
|
- name: Run Trivy vulnerability scanner
|
||||||
id: scan
|
id: scan
|
||||||
uses: aquasecurity/trivy-action@master
|
run: |
|
||||||
with:
|
trivy --server ${{ secrets.TRIVY_SERVER }} --token ${{ secrets.TRIVY_TOKEN }} image --format json docker.asperti.com/paspo/hugo:latest > trivy-results.json
|
||||||
image-ref: "docker.asperti.com/${{ github.repository_owner }}/hugo:latest"
|
|
||||||
format: "json"
|
|
||||||
output: "trivy-results.json"
|
|
||||||
|
|
||||||
# if some vulnerability is found, we fail
|
# if some vulnerability is found, we fail
|
||||||
- name: check output
|
- name: check output
|
||||||
|
22
Dockerfile
22
Dockerfile
@ -1,24 +1,26 @@
|
|||||||
##### this stage will download latest deb package
|
##### this stage will download latest tarball
|
||||||
|
|
||||||
FROM alpine:latest as prep
|
FROM alpine:latest as prep
|
||||||
|
|
||||||
ARG HUGO_ARCH=amd64
|
ARG HUGO_ARCH=amd64
|
||||||
|
|
||||||
RUN \
|
RUN \
|
||||||
apk -U add lastversion && \
|
apk --no-cache upgrade && \
|
||||||
wget $(lastversion --filter "hugo_extended_.*\-${HUGO_ARCH}\.deb$" --pre gohugoio/hugo --format assets ) -O /tmp/hugo.deb
|
apk --no-cache add curl jq && \
|
||||||
|
LATEST_RELEASE=$(curl -L -s -H 'Accept: application/json' https://github.com/gohugoio/hugo/releases/latest | jq --raw-output ".tag_name" | sed 's/^v//' ) && \
|
||||||
|
LATEST_RELEASE=0.139.4 && \
|
||||||
|
URL="https://github.com/gohugoio/hugo/releases/download/v${LATEST_RELEASE}/hugo_extended_${LATEST_RELEASE}_linux-${HUGO_ARCH}.tar.gz " && \
|
||||||
|
echo "Downloading: ${URL}" && \
|
||||||
|
wget "${URL}" -O - | tar xzv -C /tmp
|
||||||
|
|
||||||
##### final image
|
##### final image
|
||||||
|
|
||||||
FROM debian:12-slim
|
FROM alpine:latest
|
||||||
|
|
||||||
COPY --from=prep /tmp/hugo.deb /tmp/hugo.deb
|
COPY --from=prep /tmp/hugo /usr/local/bin/hugo
|
||||||
|
|
||||||
RUN \
|
RUN \
|
||||||
apt update && \
|
apk --no-cache upgrade && \
|
||||||
DEBIAN_FRONTEND=noninteractive apt -y upgrade && \
|
apk --no-cache add git gcompat libstdc++
|
||||||
apt install -y /tmp/hugo.deb && \
|
|
||||||
rm -rf /var/lib/apt/lists/ /tmp/hugo.deb
|
|
||||||
|
|
||||||
ENTRYPOINT [ "/usr/local/bin/hugo" ]
|
ENTRYPOINT [ "/usr/local/bin/hugo" ]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user