-
Notifications
You must be signed in to change notification settings - Fork 0
/
dockerfile
131 lines (82 loc) · 2.92 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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
FROM python:3.11-alpine3.19 as build
RUN apk update; \
apk add gcc
RUN pip install --upgrade \
setuptools \
wheel
RUN apk add openjdk21-jdk;
RUN apk add \
alpine-sdk \
libffi-dev \
maven;
ENV JAVA_HOME /usr/lib/jvm/java-21-openjdk
COPY requirements.txt /tmp/requirements.txt
RUN mkdir -p /tmp/python_modules; \
cd /tmp/python_modules; \
pip download --dest . --check-build-dependencies \
supervisor==4.2.5 \
-r /tmp/requirements.txt
RUN mkdir -p /tmp/python_builds;
RUN cd /tmp/python_modules; \
mkdir -p /tmp/python_builds; \
echo "[DEBUG] PATH=$PATH"; \
pip wheel --wheel-dir /tmp/python_builds --find-links . *.whl; \
pip wheel --wheel-dir /tmp/python_builds --find-links . *.tar.gz;
RUN echo $(date)\
cd /tmp; \
ls -laR /tmp
FROM python:3.11-alpine3.19
LABEL \
# org.opencontainers.image.authors="{contributor url}" \
# org.opencontainers.image.url="{dockerhub url}" \
# org.opencontainers.image.documentation="{docs url}" \
# org.opencontainers.image.source="{repo url}" \
# org.opencontainers.image.revision="{git commit sha at time of build}" \
org.opencontainers.image.title="No Fuss Computings phpIPAM Scan Agent" \
org.opencontainers.image.description="A phpIPAM Scan agent for local and remote networks" \
org.opencontainers.image.vendor="No Fuss Computing"
# org.opencontainers.image.version="{git tag}"
RUN apk --no-cache update; \
apk add \
openjdk21-jdk \
git \
dcron \
nmap;
ENV JAVA_HOME /usr/lib/jvm/java-21-openjdk
COPY --from=build /tmp/python_builds /tmp/python_builds
RUN chmod 644 -R /etc/cron.d; \
pip install /tmp/python_builds/*; \
rm -R /tmp/python_builds
ARG COLLECTION_COMMIT=none
ARG COLLECTION_BRANCH=development
ARG COLLECTION_PACKAGE=dev
COPY includes/ /
RUN mkdir -p /tmp/collection; \
if [ "$COLLECTION_PACKAGE" != "dev" ]; then \
echo "[TRACE] Package Specified"; \
ansible-galaxy collection install --force-with-deps --pre \
$COLLECTION_PACKAGE; \
elif [ "$COLLECTION_PACKAGE" == "dev" ]; then \
echo "[TRACE] Development Build"; \
git clone \
--depth=1 \
-b $COLLECTION_BRANCH \
https://gitlab.com/nofusscomputing/projects/ansible/collections/phpipam_scan_agent.git \
/tmp/collection; \
if [ "${COLLECTION_COMMIT}" != "none" ]; then git switch $COLLECTION_COMMIT; fi; \
echo "[TRACE] Installing Development Build"; \
ansible-galaxy collection install --force-with-deps --pre \
/tmp/collection/.; \
rm -Rf /tmp/collection; \
fi; \
chmod +x /etc/cron.d/*; \
chmod +x /bin/update-ca; \
chown root:root -R /etc/phpipam; \
chmod 740 -R /etc/phpipam;
WORKDIR /root
HEALTHCHECK --interval=10s --timeout=10s --start-period=5s --retries=3 CMD \
supervisorctl status || exit 1
ENV HTTP_PORT 5000
ENV ANSIBLE_FORCE_COLOR 'true'
ENV ANSIBLE_LOG_PATH /var/log/ansible.log
CMD [ "/usr/local/bin/supervisord", "-c", "/etc/supervisor/supervisord.conf" ]