netbox/Dockerfile

46 lines
1.3 KiB
Docker

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
RUN apt install python-is-python3 git ca-certificates lsb-release apt-transport-https wget curl nano vim locales -y \
&& apt auto-remove -y \
&& apt clean -y
RUN sed -i '/en_US.UTF-8/s/^# //g' /etc/locale.gen \
&& locale-gen
# Install Pip
RUN apt install python3-pip -y
# clone repo
RUN git clone -b master --depth 1 https://github.com/netbox-community/netbox.git /opt/netbox
# change working dir to repo
WORKDIR /opt/netbox
# 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
# change working dir to application
WORKDIR /opt/netbox/netbox
# 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
# run the service
CMD ["python", "manage.py", "runserver", "0.0.0.0:8000"]