Compare commits
2 Commits
ce977dea8c
...
be4fbc5eca
| Author | SHA1 | Date | |
|---|---|---|---|
|
be4fbc5eca
|
|||
|
7b9ebf426b
|
32
Dockerfile
32
Dockerfile
@@ -10,34 +10,28 @@ RUN apt update && apt upgrade -y
|
||||
ENV LANG en_US.UTF-8
|
||||
ENV LANGUAGE en_US:en
|
||||
ENV LC_ALL en_US.UTF-8
|
||||
RUN apt install git ca-certificates lsb-release apt-transport-https wget curl nano vim locales -y \
|
||||
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
|
||||
|
||||
RUN apt-get update && apt-get install -y \
|
||||
git \
|
||||
python3-pip \
|
||||
python3-dev \
|
||||
libpq-dev \
|
||||
libxml2-dev \
|
||||
libxslt1-dev \
|
||||
libffi-dev \
|
||||
libyaml-dev \
|
||||
build-essential \
|
||||
libssl-dev \
|
||||
libpq-dev
|
||||
# Install Pip
|
||||
RUN apt install python3-pip -y
|
||||
|
||||
# clone repo
|
||||
RUN git clone https://github.com/netbox-community/netbox.git /opt/netbox
|
||||
|
||||
# change working dir to repo
|
||||
WORKDIR /opt/netbox
|
||||
|
||||
RUN pip3 install --upgrade pip
|
||||
RUN pip3 install -r requirements.txt
|
||||
# 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
|
||||
|
||||
RUN apt-get remove -y git python3-dev build-essential libssl-dev libpq-dev
|
||||
RUN apt-get autoremove -y
|
||||
# change working dir to application
|
||||
WORKDIR /opt/netbox/netbox
|
||||
|
||||
EXPOSE 8000
|
||||
CMD ["python3", "netbox/manage.py", "runserver", "0.0.0.0:8000"]
|
||||
# run the service
|
||||
CMD ["python", "manage.py", "runserver", "0.0.0.0:8000"]
|
||||
|
||||
47
README.md
Normal file
47
README.md
Normal file
@@ -0,0 +1,47 @@
|
||||
|
||||
|
||||
- Production `docker-compose.yml`
|
||||
|
||||
```yaml
|
||||
version: '3.5'
|
||||
services:
|
||||
################################################
|
||||
netbox:
|
||||
image: git.shihaam.dev/dockerfiles/netbox
|
||||
ports:
|
||||
- 8000:8000
|
||||
volumes:
|
||||
- ./configuration.py:/opt/netbox/netbox/netbox/configuration.py
|
||||
command: python manage.py runserver 0.0.0.0:8000 --insecure # COMMENT THIS LINE WHEN RUNNING IN PRODUCTION
|
||||
depends_on:
|
||||
- redis
|
||||
- postgres
|
||||
################################################
|
||||
postgres:
|
||||
image: postgres:13-alpine
|
||||
volumes:
|
||||
- ./data/db:/var/lib/postgresql/data
|
||||
environment:
|
||||
- POSTGRES_DB=netbox
|
||||
- POSTGRES_USER=netbox
|
||||
- POSTGRES_PASSWORD=even-confider-closable
|
||||
restart: always
|
||||
################################################
|
||||
redis:
|
||||
image: redis:6.0-alpine
|
||||
restart: always
|
||||
```
|
||||
|
||||
- save this as docker-compose.yml and run `docker compose up -d`
|
||||
|
||||
## Some commands that will be useful
|
||||
- Migrate Database (required on initial install and upgrade
|
||||
```bash
|
||||
docker compose exec netbox ./manage.py migrate
|
||||
```
|
||||
- Create new Superuser account, (it might not show any output, just enter a username and press enter)
|
||||
```bash
|
||||
docker compose exec netbox ./manage.py createsuperuser
|
||||
```
|
||||
|
||||
|
||||
Reference in New Issue
Block a user