forked from ansible/ansible-rulebook
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
46 lines (37 loc) · 1.3 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
FROM quay.io/centos/centos:stream9
ARG USER_ID=${USER_ID:-1001}
ARG APP_DIR=${APP_DIR:-/app}
ARG DEVEL_COLLECTION_LIBRARY=0
ARG DEVEL_COLLECTION_REPO=git+https://github.com/ansible/event-driven-ansible.git
ENV JAVA_HOME=/usr/lib/jvm/java-17-openjdk
ENV PATH="$APP_DIR/.local/bin:$PATH"
ENV PYTHONPATH="$APP_DIR/.local/lib/python3.9/site-packages:$PYTHONPATH"
ENV HOME=$APP_DIR
USER 0
# support random uid number and gid 0 for openshift
RUN for dir in \
$APP_DIR \
$APP_DIR/.local \
$APP_DIR/.local/bin \
$APP_DIR/.local/lib \
$APP_DIR/.local/lib/python3.9/site-packages \
$APP_DIR/.ansible; \
do mkdir -p $dir ; chown -R "${USER_ID}:0" $dir ; chmod 0775 $dir ; done \
&& useradd --uid "$USER_ID" --gid 0 --home-dir "$APP_DIR" appuser
RUN dnf install -y java-17-openjdk-devel python3-pip postgresql-devel gcc python3-devel git
USER $USER_ID
WORKDIR $APP_DIR
COPY --chown=${USER_ID}:0 . $WORKDIR
RUN pip install -U pip \
&& pip install ansible-core \
ansible-runner \
jmespath \
aiohttp \
aiokafka \
watchdog \
azure-servicebus \
aiobotocore \
&& ansible-galaxy collection install ansible.eda
RUN bash -c "if [ $DEVEL_COLLECTION_LIBRARY -ne 0 ]; then \
ansible-galaxy collection install ${DEVEL_COLLECTION_REPO} --force; fi"
RUN pip install .[production]