diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index 82f22b1..7bf0632 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -65,13 +65,3 @@ If your log is very long, create a Gist instead (and post the link to it): https ```text LOG LOG LOG ``` - -The output of `docker-compose logs nginx`: - - -```text -LOG LOG LOG -``` diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index e1780b7..09bc661 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -19,7 +19,7 @@ jobs: - ./build.sh develop docker_from: - '' # use the default of the build script - # - python:3.10-rc-alpine # disable until dependencies work + - alpine:edge fail-fast: false runs-on: ubuntu-latest name: Builds new Netbox Docker Images diff --git a/Dockerfile b/Dockerfile index 8db4cac..272f882 100644 --- a/Dockerfile +++ b/Dockerfile @@ -12,27 +12,15 @@ RUN apk add --no-cache \ libffi-dev \ libxslt-dev \ openldap-dev \ - postgresql-dev - -WORKDIR /install - -RUN pip install --prefix="/install" --no-warn-script-location \ -# gunicorn is used for launching netbox - gunicorn \ - greenlet \ - eventlet \ -# napalm is used for gathering information from network devices - napalm \ -# ruamel is used in startup_scripts - 'ruamel.yaml>=0.15,<0.16' \ -# django_auth_ldap is required for ldap - django_auth_ldap \ -# django-storages was introduced in 2.7 and is optional - django-storages + postgresql-dev \ + py3-pip \ + python3-dev \ + && python3 -m venv /opt/netbox/venv \ + && /opt/netbox/venv/bin/python3 -m pip install --upgrade pip setuptools ARG NETBOX_PATH -COPY ${NETBOX_PATH}/requirements.txt / -RUN pip install --prefix="/install" --no-warn-script-location -r /requirements.txt +COPY ${NETBOX_PATH}/requirements.txt requirements-container.txt / +RUN /opt/netbox/venv/bin/pip install -r /requirements.txt -r /requirements-container.txt ### # Main stage @@ -44,6 +32,7 @@ FROM ${FROM} as main RUN apk add --no-cache \ bash \ ca-certificates \ + curl \ graphviz \ libevent \ libffi \ @@ -51,35 +40,38 @@ RUN apk add --no-cache \ libressl \ libxslt \ postgresql-libs \ - ttf-ubuntu-font-family + python3 \ + py3-pip \ + ttf-ubuntu-font-family \ + unit \ + unit-python3 WORKDIR /opt -COPY --from=builder /install /usr/local +COPY --from=builder /opt/netbox/venv /opt/netbox/venv ARG NETBOX_PATH COPY ${NETBOX_PATH} /opt/netbox COPY docker/configuration.docker.py /opt/netbox/netbox/netbox/configuration.py -COPY docker/gunicorn_config.py /etc/netbox/ -COPY docker/nginx.conf /etc/netbox-nginx/nginx.conf COPY docker/docker-entrypoint.sh /opt/netbox/docker-entrypoint.sh +COPY docker/launch-netbox.sh /opt/netbox/launch-netbox.sh COPY startup_scripts/ /opt/netbox/startup_scripts/ COPY initializers/ /opt/netbox/initializers/ COPY configuration/ /etc/netbox/config/ +COPY docker/nginx-unit.json /etc/unit/ WORKDIR /opt/netbox/netbox -# Must set permissions for '/opt/netbox/netbox/static' directory -# to g+w so that `./manage.py collectstatic` can be executed during -# container startup. # Must set permissions for '/opt/netbox/netbox/media' directory # to g+w so that pictures can be uploaded to netbox. -RUN mkdir static && chmod -R g+w static media +RUN mkdir -p static /opt/unit/state/ /opt/unit/tmp/ \ + && chmod -R g+w media /opt/unit/ \ + && SECRET_KEY="dummy" /opt/netbox/venv/bin/python /opt/netbox/netbox/manage.py collectstatic --no-input ENTRYPOINT [ "/opt/netbox/docker-entrypoint.sh" ] -CMD ["gunicorn", "-c /etc/netbox/gunicorn_config.py", "netbox.wsgi"] +CMD [ "/opt/netbox/launch-netbox.sh" ] LABEL ORIGINAL_TAG="" \ NETBOX_GIT_BRANCH="" \ diff --git a/README.md b/README.md index 11edf52..0125c29 100644 --- a/README.md +++ b/README.md @@ -56,7 +56,7 @@ cd netbox-docker tee docker-compose.override.yml <=0.15,<0.16 +django-auth-ldap==2.2.0 +django-storages==1.10.1 \ No newline at end of file diff --git a/test.sh b/test.sh index fa6fa38..2249316 100755 --- a/test.sh +++ b/test.sh @@ -35,7 +35,7 @@ if [ -z "${IMAGE}" ]; then fi # The docker compose command to use -doco="docker-compose -f docker-compose.test.yml" +doco="docker-compose --file docker-compose.test.yml --project-name netbox_docker_test_${1}" INITIALIZERS_DIR=".initializers"