-
-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: vulnz Docker * fix: stop gzipping in vulnz Docker after cache cve * fix: update documentation according to gzip feature * Add docs - Add option to adjust the memory - Add volume definition, build docs - Add bash to the docker image * Add CI integration * Move version to gradle properties * Add delay management, fix docs, fix image location Co-authored-by: Jeremy Long <[email protected]> * Adjust workflow and add docker hub --------- Co-authored-by: j.berlin <[email protected]> Co-authored-by: Jeremy Long <[email protected]>
- Loading branch information
1 parent
6a0cec5
commit e4ffbd7
Showing
10 changed files
with
246 additions
and
12 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
name: docker pr | ||
|
||
on: | ||
push: | ||
branches-ignore: | ||
- 'main' | ||
|
||
env: | ||
IMAGE_FQDN: ghcr.io/jeremylong/open-vulnerability-data-mirror | ||
VERSION: 0.0.0-SNAPSHOT | ||
|
||
jobs: | ||
docker-pr: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v2 | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
- name: Set up JDK 11 | ||
uses: actions/setup-java@v3 | ||
with: | ||
java-version: '11' | ||
distribution: 'temurin' | ||
- name: Run build | ||
run: ./gradlew -x test -Pversion=${{ env.VERSION }} vulnz:build | ||
- name: Build docker image | ||
uses: docker/build-push-action@v3 | ||
with: | ||
context: vulnz/ | ||
platforms: linux/amd64 | ||
push: false | ||
tags: | | ||
${{ env.IMAGE_FQDN }}:${{ env.VERSION }} | ||
build-args: | | ||
BUILD_VERSION=${{ env.VERSION }} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
name: docker pr | ||
|
||
on: | ||
push: | ||
tags: | ||
- v* | ||
|
||
env: | ||
GHCR_IMAGE_FQDN: ghcr.io/jeremylong/open-vulnerability-data-mirror | ||
HUB_IMAGE_FQDN: jeremylong/open-vulnerability-data-mirror | ||
VERSION: ${{ github.ref_name }} | ||
|
||
jobs: | ||
docker-release: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v2 | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
- name: Login to GHCR | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.repository_owner }} | ||
password: ${{ github.token }} | ||
- name: Login to Docker Hub | ||
uses: docker/login-action@v3 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
- name: Set up JDK 11 | ||
uses: actions/setup-java@v3 | ||
with: | ||
java-version: '11' | ||
distribution: 'temurin' | ||
- name: Run build | ||
run: ./gradlew -x test -Pversion=${{ env.VERSION }} vulnz:build | ||
- name: Build docker image | ||
uses: docker/build-push-action@v3 | ||
with: | ||
context: vulnz/ | ||
platforms: linux/amd64 | ||
push: true | ||
tags: | | ||
${{ env.GHCR_IMAGE_FQDN }}:${{ env.VERSION }} | ||
${{ env.GHCR_IMAGE_FQDN }}:latest | ||
${{ env.HUB_IMAGE_FQDN }}:${{ env.VERSION }} | ||
${{ env.HUB_IMAGE_FQDN }}:latest | ||
build-args: | | ||
BUILD_VERSION=${{ env.VERSION }} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
version = '5.1.1' |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,7 +12,6 @@ plugins { | |
} | ||
|
||
group 'io.github.jeremylong' | ||
version = '5.1.1' | ||
|
||
repositories { | ||
mavenCentral() | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
FROM httpd:alpine | ||
|
||
ARG BUILD_DATE | ||
ARG BUILD_VERSION | ||
|
||
ARG http_proxy | ||
ARG https_proxy | ||
ARG no_proxy | ||
|
||
LABEL authors="derhecht,stevespringett,jeremylong" | ||
LABEL maintainer="[email protected]" | ||
LABEL name="jeremylong/vulnz" | ||
LABEL version=$BUILD_VERSION | ||
LABEL org.label-schema.schema-version="1.0" | ||
LABEL org.label-schema.build-date=$BUILD_DATE | ||
LABEL org.label-schema.name="jeremylong/vulnz" | ||
LABEL org.label-schema.description="Persist the data using the open-vulnerability-store." | ||
LABEL org.label-schema.url="https://github.com/jeremylong/Open-Vulnerability-Project" | ||
LABEL org.label-schema.vcs-url="https://github.com/jeremylong/Open-Vulnerability-Project" | ||
LABEL org.label-schema.vendor="jeremylong" | ||
LABEL org.label-schema.version=$BUILD_VERSION | ||
LABEL org.label-schema.docker.cmd="docker run -it --rm --name mirror -e NVD_API_KEY=YOUR_API_KEY_HERE -p 80:80 jeremylong/vulnz" | ||
|
||
ENV user=mirror | ||
ENV BUILD_VERSION=$BUILD_VERSION | ||
ENV JAVA_OPT=-Xmx2g | ||
|
||
RUN apk update && \ | ||
apk add --no-cache bash openjdk11 dcron nss supervisor && \ | ||
addgroup -S "$user" && \ | ||
adduser -S "$user" -G "$user" && \ | ||
chown -R "$user":"$user" /usr/local/apache2/htdocs && \ | ||
rm -v /usr/local/apache2/htdocs/index.html | ||
|
||
COPY ["/src/docker/conf/supervisord.conf", "/etc/supervisor/conf.d/supervisord.conf"] | ||
COPY ["/src/docker/scripts/mirror.sh", "/mirror.sh"] | ||
COPY ["/src/docker/crontab/mirror", "/etc/crontabs/mirror"] | ||
COPY ["/src/docker/conf/mirror.conf", "/usr/local/apache2/conf"] | ||
COPY ["/build/libs/vulnz-$BUILD_VERSION.jar", "/usr/local/bin/vulnz"] | ||
|
||
VOLUME /usr/local/apache2/htdocs | ||
EXPOSE 80/tcp | ||
|
||
CMD ["/usr/bin/supervisord", "-n", "-c", "/etc/supervisor/conf.d/supervisord.conf", "-l", "/var/log/supervisord.log", "-j", "/var/run/supervisord.pid"] |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# | ||
# Configuration for the httpd mirror | ||
# | ||
ServerName localhost | ||
<Directory /usr/local/apache2/htdocs> | ||
Options +Indexes +MultiViews | ||
IndexOptions FancyIndexing -SuppressLastModified | ||
</Directory> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
[supervisord] | ||
nodaemon=true | ||
user=root | ||
|
||
[program:crond] | ||
command=crond -s /var/spool/cron/crontabs -f | ||
stdout_logfile=/dev/fd/1 | ||
stdout_logfile_maxbytes=0 | ||
redirect_stderr=true | ||
|
||
[program:httpd] | ||
command=/usr/local/bin/httpd-foreground | ||
stdout_logfile=/dev/fd/1 | ||
stdout_logfile_maxbytes=0 | ||
redirect_stderr=true | ||
|
||
[program:initialize_htdocs] | ||
command=/mirror.sh | ||
autorestart=false | ||
stdout_logfile=/dev/fd/1 | ||
stdout_logfile_maxbytes=0 | ||
redirect_stderr=true | ||
user=mirror |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
0 0 * * * /mirror.sh |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#!/bin/sh | ||
|
||
echo "Updating..." | ||
|
||
DELAY_ARG="" | ||
if [ -z $NVD_API_KEY ]; then | ||
DELAY_ARG="--delay=10000" | ||
fi | ||
|
||
if [ -z $DELAY ]; then | ||
DELAY_ARG="--delay=$DELAY" | ||
fi | ||
|
||
java $JAVA_OPT -jar /usr/local/bin/vulnz cve $DELAY_ARG --cache --directory /usr/local/apache2/htdocs |