diff --git a/Dockerfile b/Dockerfile index 5efda97..01db349 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,21 +1,24 @@ -FROM alpine:3.14 +FROM alpine:latest -RUN apk add --no-cache python3 git ghostscript sqlite +ENV TARGET=/opt/polyphonic +ENV RELEASE=polyphonic-0.8.3-py3-none-any.whl + +RUN apk add --no-cache python3 py3-pip git ghostscript sqlite WORKDIR /root -RUN python3 -m ensurepip -RUN pip3 install -U pip --no-cache-dir -COPY app/requirements.txt . -RUN pip3 install -r requirements.txt --no-cache-dir +RUN python3 -m venv ${TARGET} +ENV PATH="${TARGET}/bin:$PATH" -COPY app /opt/polyphonic -WORKDIR /opt/polyphonic +COPY dist/${RELEASE} . +RUN pip3 install ${RELEASE} --no-cache-dir -COPY docker_settings.py polyphonic/local_settings.py -RUN SECRET_KEY=_ python3 manage.py collectstatic --noinput +WORKDIR ${TARGET} + +COPY docker_settings.py local_settings.py +RUN SECRET_KEY=_ ${TARGET}/bin/manage collectstatic --noinput VOLUME ["/var/polyphonic"] -ENTRYPOINT ["python3", "manage.py"] +ENTRYPOINT ["manage"] CMD ["runserver", "0.0.0.0:8000", "--insecure"] diff --git a/app/polyphonic/settings.py b/app/polyphonic/settings.py index cf49f75..2b8433f 100644 --- a/app/polyphonic/settings.py +++ b/app/polyphonic/settings.py @@ -1,5 +1,10 @@ +import os +import sys + +sys.path.insert(0, os.getcwd()) + try: - from .local_settings import * # noqa + from local_settings import * # noqa except ImportError: from .default_settings import * # noqa diff --git a/docker_settings.py b/docker_settings.py index 72447ba..7730e7f 100644 --- a/docker_settings.py +++ b/docker_settings.py @@ -1,8 +1,13 @@ -from .default_settings import * +from polyphonic.default_settings import * +import os + +DEBUG = bool(os.environ.get("DEBUG", False)) + +CACHE_DIR = "/var/polyphonic/cache" DATABASES = { - 'default': { - 'ENGINE': 'django.db.backends.sqlite3', - 'NAME': '/var/polyphonic/db.sqlite3', + "default": { + "ENGINE": "django.db.backends.sqlite3", + "NAME": "/var/polyphonic/db.sqlite3", } } diff --git a/pyproject.toml b/pyproject.toml index ec629d0..65aeab8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -17,7 +17,8 @@ dependencies = [ "requests (>=2.32.5,<3.0.0)", "django-storages (>=1.14.6,<2.0.0)", "boto3 (>=1.40.20,<2.0.0)", - "whoosh (>=2.7.4,<3.0.0)" + "whoosh (>=2.7.4,<3.0.0)", + "tzdata (>=2026.2,<2027.0)" ] [tool.poetry]