netbox/Dockerfile

46 lines
1.3 KiB
Docker
Raw Permalink Normal View History

2023-01-23 10:38:30 +05:00
FROM debian:11-slim
# set work dir
WORKDIR /root/
# Set build shell to bash, default has has some issues sometimes
SHELL ["/bin/bash", "-c"]
RUN apt update && apt upgrade -y
# Language setup and Initial repo update
ENV LANG en_US.UTF-8
ENV LANGUAGE en_US:en
ENV LC_ALL en_US.UTF-8
2023-01-23 14:08:23 +05:00
RUN apt install python-is-python3 git ca-certificates lsb-release apt-transport-https wget curl nano vim locales -y \
2023-01-23 10:38:30 +05:00
&& apt auto-remove -y \
&& apt clean -y
RUN sed -i '/en_US.UTF-8/s/^# //g' /etc/locale.gen \
&& locale-gen
2023-01-23 14:08:23 +05:00
# Install Pip
RUN apt install python3-pip -y
2023-01-23 10:38:30 +05:00
2023-01-23 14:08:23 +05:00
# clone repo
2023-01-24 08:56:45 +05:00
RUN git clone -b master --depth 1 https://github.com/netbox-community/netbox.git /opt/netbox
2023-01-23 10:38:30 +05:00
2023-01-23 14:08:23 +05:00
# change working dir to repo
2023-01-23 10:38:30 +05:00
WORKDIR /opt/netbox
2023-01-23 14:08:23 +05:00
# install requiremnets and some clean up
RUN pip install -r requirements.txt \
&& apt-get remove -y git python3-dev build-essential libssl-dev libpq-dev \
&& apt-get autoremove -y
2023-01-23 10:38:30 +05:00
2023-01-23 14:08:23 +05:00
# change working dir to application
WORKDIR /opt/netbox/netbox
2023-01-23 10:38:30 +05:00
2023-01-25 07:58:53 +05:00
# Static files generation
RUN cp netbox/configuration_example.py netbox/configuration.py \
&& python manage.py collectstatic --no-input \
&& rm netbox/configuration.py
# Web server setup
RUN cp /opt/netbox/contrib/gunicorn.py /opt/netbox/gunicorn.py
2023-01-23 14:08:23 +05:00
# run the service
CMD ["python", "manage.py", "runserver", "0.0.0.0:8000"]