-
Notifications
You must be signed in to change notification settings - Fork 9
/
Dockerfile
50 lines (36 loc) · 1.77 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
FROM oraclelinux:9-slim AS supercronic
ENV SUPERCRONIC_URL=https://github.com/aptible/supercronic/releases/download/v0.2.30/supercronic-linux-amd64 \
SUPERCRONIC=supercronic-linux-amd64 \
SUPERCRONIC_SHA1SUM=9f27ad28c5c57cd133325b2a66bba69ba2235799
RUN 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.4.1
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 && \
microdnf install java-21-openjdk-headless procps; \
microdnf clean all
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"]