-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
42 lines (34 loc) · 948 Bytes
/
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
FROM alpine:3
LABEL org.opencontainers.image.source="https://github.com/zebbra/netbox-init"
LABEL org.opencontainers.image.description="NetBox fixture loader"
RUN apk add --no-cache \
ansible \
bash \
ca-certificates \
curl \
git \
make \
openssh \
py3-dnspython \
py3-passlib \
py3-pip \
py3-tz \
python3 \
vim
RUN pip install --break-system-packages pynetbox
ENV INIT_DIR=/srv/init
ENV DEVICE_TYPE_FILES_DIR=${INIT_DIR}/device_types
ENV INIT_GENERATOR_DIR=${INIT_DIR}/gen
ENV VAR_FILES_DIR=${INIT_DIR}/vars
RUN mkdir -p $DEVICE_TYPE_FILES_DIR $INIT_GENERATOR_DIR $VAR_FILES_DIR
ENV HOME=/home
RUN adduser -D -h ${HOME} ansible
COPY init/generator ${HOME}/generator
COPY init/ansible/ansible.cfg ${HOME}/.ansible.cfg
RUN chown -R ansible:ansible ${HOME}
USER ansible
RUN ansible-galaxy collection install --force netbox.netbox
WORKDIR ${HOME}
ENV NETBOX_URL=""
ENV NETBOX_TOKEN=""
CMD ["/home/generator/init.sh"]