This repository has been archived by the owner on Nov 4, 2022. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e901143
commit 9a8ff3d
Showing
9 changed files
with
105 additions
and
28 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 |
---|---|---|
@@ -1,22 +1,43 @@ | ||
FROM httpd:alpine | ||
|
||
MAINTAINER Jeremy Long <jeremy.long@gmail.com> | ||
ARG BUILD_DATE | ||
ARG BUILD_VERSION | ||
|
||
# Labels. | ||
LABEL maintainer="jeremy.long@gmail.com" | ||
LABEL name="springett/nvdmirror" | ||
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="springett/nvdmirror" | ||
LABEL org.label-schema.description="NIST Data Mirror" | ||
LABEL org.label-schema.url="https://github.com/stevespringett/nist-data-mirror" | ||
LABEL org.label-schema.vcs-url="https://github.com/ballerinalang/container-support" | ||
LABEL org.label-schema.vendor="springett" | ||
LABEL org.label-schema.version=$BUILD_VERSION | ||
LABEL org.label-schema.docker.cmd="docker run -dit --name mirror -p 80:80 --mount type=bind,source=\"$(pwd)\"/target/docs/,target=/usr/local/apache2/htdocs springett/nvdmirror" | ||
|
||
ENV user=mirror | ||
|
||
RUN apk update && \ | ||
apk add --no-cache openjdk8 dcron nano && \ | ||
apk add --no-cache openjdk8-jre dcron nss && \ | ||
mkdir -p /var/log/cron && \ | ||
mkdir -m 0644 -p /var/spool/cron/crontabs && \ | ||
touch /var/log/cron.log && \ | ||
mkdir -m 0644 -p /etc/cron.d && \ | ||
mkdir -p /var/spool/cron/crontabs && \ | ||
mkdir /tmp/nvd && \ | ||
mkdir /usr/local/apache2/htdocs/backup && \ | ||
adduser -D ${user} && \ | ||
touch /var/log/cron.log && \ | ||
rm -rf /var/lib/apt/lists/* /tmp/* | ||
|
||
RUN echo "Include conf/mirror.conf" | ||
COPY /src/docker/scripts/* / | ||
COPY /src/docker/crontab/* /etc/cron.d/ | ||
COPY /src/docker/crontab/* /var/spool/cron/crontabs/mirror | ||
COPY /src/docker/conf/mirror.conf /usr/local/apache2/conf | ||
COPY /target/nist-data-mirror.jar /usr/local/bin/ | ||
|
||
EXPOSE 80/tcp | ||
|
||
#USER ${user} | ||
|
||
ENTRYPOINT ["/entry.sh"] | ||
CMD ["/cmd.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,3 @@ | ||
#!/bin/sh | ||
|
||
docker build --no-cache=true --build-arg BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ') -t springett/nvdmirror . |
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 @@ | ||
#!/bin/sh | ||
|
||
mkdir target/docs | ||
docker run -dit \ | ||
--name mirror \ | ||
-p 80:80 \ | ||
--mount type=bind,source="$(pwd)"/target/docs/,target=/usr/local/apache2/htdocs \ | ||
springett/nvdmirror |
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,4 @@ | ||
#!/bin/sh | ||
|
||
#id=${docker ps -aqf 'name=mirror'} | ||
docker exec -it mirror /bin/bash |
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
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 |
---|---|---|
@@ -1,10 +1,14 @@ | ||
#!/bin/sh | ||
|
||
echo "Starting mirror" | ||
/mirror.sh | ||
/usr/local/bin/httpd-foreground | ||
rm -f /usr/local/apache2/htdocs/*.html | ||
|
||
# | ||
# see https://github.com/xordiv/docker-alpine-cron | ||
# | ||
crond -s /var/spool/cron/crontabs -b -L /var/log/cron.log "$@" && tail -f /var/log/cron.log | ||
crond -s /var/spool/cron/crontabs -b -L /var/log/cron.log "$@" && tail -f /var/log/cron.log & | ||
|
||
echo "Mirror started" | ||
/usr/local/bin/httpd-foreground | ||
rm -f /usr/local/apache2/htdocs/*.html | ||
|
||
|
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 |
---|---|---|
@@ -1,15 +1,3 @@ | ||
#!/bin/sh | ||
|
||
# | ||
# see https://github.com/xordiv/docker-alpine-cron | ||
# | ||
|
||
set -e | ||
|
||
rm -rf /var/spool/cron/crontabs && mkdir -m 0644 -p /var/spool/cron/crontabs | ||
|
||
[ "$(ls -A /etc/cron.d)" ] && cp -f /etc/cron.d/* /var/spool/cron/crontabs/ || true | ||
|
||
chmod -R 0644 /var/spool/cron/crontabs | ||
|
||
exec "$@" |
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