-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
55 lines (40 loc) · 1.93 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
FROM debian:bullseye-slim AS supercronic
ENV SUPERCRONIC_URL=https://github.com/aptible/supercronic/releases/download/v0.2.1/supercronic-linux-amd64 \
SUPERCRONIC=supercronic-linux-amd64 \
SUPERCRONIC_SHA1SUM=d7f4c0886eb85249ad05ed592902fa6865bb9d70
RUN apt-get update; apt-get install -y curl \
&& curl -fsSLO "$SUPERCRONIC_URL" \
&& echo "${SUPERCRONIC_SHA1SUM} ${SUPERCRONIC}" | sha1sum -c - \
&& chmod +x "$SUPERCRONIC" \
&& mv "$SUPERCRONIC" "/usr/local/bin/${SUPERCRONIC}" \
&& ln -s "/usr/local/bin/${SUPERCRONIC}" /usr/local/bin/supercronic
FROM mysql:8.0.35-debian
LABEL maintainer="Stefan Neuhaus <[email protected]>"
ENV MYSQL_DATABASE=dependencycheck \
MYSQL_RANDOM_ROOT_PASSWORD=true \
MYSQL_ONETIME_PASSWORD=true \
MYSQL_USER=dc \
MYSQL_PASSWORD=dc
WORKDIR /dependencycheck
RUN set -ex && \
apt-get update; \
mkdir -p /usr/share/man/man1; \
apt-get install -y openjdk-11-jre-headless procps cron; \
apt-get purge -y --auto-remove; \
rm -rf /var/lib/apt
COPY overlays/wrapper.sh /
COPY overlays/dependencycheck /dependencycheck/
COPY overlays/docker-entrypoint-initdb.d /docker-entrypoint-initdb.d/
RUN set -ex && \
/dependencycheck/gradlew wrapper; \
echo "0/2 * * * * /dependencycheck/update.sh" > /dependencycheck/database-update-schedule; \
chown --recursive mysql:mysql /dependencycheck
COPY --from=supercronic /usr/local/bin/supercronic /usr/local/bin/
RUN set -ex && \
cat /dev/urandom | tr -dc _A-Za-z0-9 | head -c 32 >/dependencycheck/dc-update.pwd; \
chmod 400 /dependencycheck/dc-update.pwd; \
sed -i "s/<DC_UPDATE_PASSWORD>/`cat /dependencycheck/dc-update.pwd`/" /dependencycheck/build.gradle; \
sed -i "s/<DC_UPDATE_PASSWORD>/`cat /dependencycheck/dc-update.pwd`/" /docker-entrypoint-initdb.d/initialize_security.sql; \
sed -i "s/<MYSQL_USER>/${MYSQL_USER}/" /docker-entrypoint-initdb.d/initialize_security.sql
EXPOSE 3306
CMD ["/wrapper.sh"]