mirror of
https://gitea.mueller.network/extern/django-helpdesk.git
synced 2024-11-21 07:23:07 +01:00
dockerize, fixes #826
This commit is contained in:
parent
67eb0974c7
commit
0b89afc16b
44
Dockerfile
Normal file
44
Dockerfile
Normal file
@ -0,0 +1,44 @@
|
||||
ARG PYTHON_VERSION=3.11.5-slim-bookworm
|
||||
|
||||
# define an alias for the specfic python version used in this file.
|
||||
FROM python:${PYTHON_VERSION} as python
|
||||
|
||||
FROM python as python-build-stage
|
||||
|
||||
# Install apt packages
|
||||
RUN apt-get update && apt-get install --no-install-recommends -y \
|
||||
# dependencies for building Python packages
|
||||
build-essential
|
||||
|
||||
# Requirements are installed here to ensure they will be cached.
|
||||
COPY ./requirements.txt ./requirements-dev.txt /
|
||||
|
||||
# Create Python Dependency and Sub-Dependency Wheels
|
||||
RUN pip wheel --wheel-dir /usr/src/app/wheels \
|
||||
-r requirements.txt \
|
||||
-r requirements-dev.txt
|
||||
|
||||
FROM python as python-run-stage
|
||||
|
||||
ARG APP_HOME=/app
|
||||
|
||||
ENV PYTHONUNBUFFERED 1
|
||||
ENV PYTHONDONTWRITEBYTECODE 1
|
||||
|
||||
WORKDIR ${APP_HOME}
|
||||
|
||||
COPY --from=python-build-stage /usr/src/app/wheels /wheels/
|
||||
|
||||
# use wheels to install python dependencies
|
||||
RUN pip install --no-cache-dir --no-index --find-links=/wheels/ /wheels/* \
|
||||
&& rm -rf /wheels/
|
||||
|
||||
COPY ./entrypoint /entrypoint
|
||||
RUN sed -i 's/\r$//g' /entrypoint && chmod +x /entrypoint
|
||||
|
||||
FROM python-run-stage AS backend
|
||||
|
||||
# copy application code to WORKDIR
|
||||
COPY . ${APP_HOME}
|
||||
|
||||
ENTRYPOINT ["/entrypoint"]
|
10
README.rst
10
README.rst
@ -27,11 +27,17 @@ get started with testing or developing `django-helpdesk`. The demo project
|
||||
resides in the `demo/` top-level folder.
|
||||
|
||||
It's likely that you can start up a demo project server by running
|
||||
only the command::
|
||||
only the command:
|
||||
|
||||
make rundemo
|
||||
|
||||
then pointing your web browser at `localhost:8080`.
|
||||
or with docker:
|
||||
|
||||
docker build . -t demodesk
|
||||
docker run --rm -v "$PWD:/app" -p 8080:8080 demodesk
|
||||
|
||||
then pointing your web browser at http://localhost:8080 (log in as user
|
||||
`admin`` with password `Test1234`).
|
||||
|
||||
For more information and options, please read the `demo/README.rst` file.
|
||||
|
||||
|
14
entrypoint
Normal file
14
entrypoint
Normal file
@ -0,0 +1,14 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -o errexit
|
||||
set -o pipefail
|
||||
set -o nounset
|
||||
|
||||
pip3 install -e . --user || pip3 install -e .
|
||||
pip3 install -e demo --user || pip3 install -e demo
|
||||
python3 demo/manage.py migrate --noinput
|
||||
DJANGO_SUPERUSER_PASSWORD=Test1234 python3 demo/manage.py createsuperuser --username admin --email helpdesk@example.com --noinput
|
||||
# Install fixtures
|
||||
python3 demo/manage.py loaddata emailtemplate.json
|
||||
python3 demo/manage.py loaddata demo.json
|
||||
python3 demo/manage.py runserver 0:8080
|
Loading…
Reference in New Issue
Block a user