Compare commits
No commits in common. "116e2c15778fa2f33145af2e8319b7b7408c051a" and "eadd7a561269b3eaeb6027b3e59bf2b8f08627d7" have entirely different histories.
116e2c1577
...
eadd7a5612
6 changed files with 21 additions and 13 deletions
15
Dockerfile
15
Dockerfile
|
|
@ -1,9 +1,8 @@
|
|||
# stage 1
|
||||
FROM python:3.11-alpine AS backend
|
||||
|
||||
ARG USER_ID=1000
|
||||
ARG GROUP_ID=1000
|
||||
ARG UV_LINK_MODE=copy
|
||||
ARG USER_UID=1000
|
||||
ARG GROUP_UID=1000
|
||||
|
||||
RUN apk update \
|
||||
&& apk add --no-cache \
|
||||
|
|
@ -11,7 +10,7 @@ RUN apk update \
|
|||
curl \
|
||||
gettext
|
||||
|
||||
RUN addgroup -g $USER_ID newsreader && adduser -Du $GROUP_ID -G newsreader newsreader
|
||||
RUN addgroup -g $USER_UID newsreader && adduser -Du $GROUP_UID -G newsreader newsreader
|
||||
|
||||
RUN mkdir --parents /app/src /app/logs /app/media /app/bin /app/static \
|
||||
&& chown -R newsreader:newsreader /app
|
||||
|
|
@ -24,7 +23,7 @@ COPY --chown=newsreader:newsreader uv.lock pyproject.toml /app/
|
|||
|
||||
COPY --from=ghcr.io/astral-sh/uv:python3.11-alpine /usr/local/bin/uv /bin/uv
|
||||
|
||||
RUN --mount=type=cache,uid=$USER_ID,gid=$GROUP_ID,target=/home/newsreader/.cache/uv \
|
||||
RUN --mount=type=cache,target=$HOME/.cache/uv \
|
||||
uv sync --frozen --no-default-groups --no-install-project
|
||||
|
||||
COPY --chown=newsreader:newsreader ./bin/docker-entrypoint.sh /app/bin/docker-entrypoint.sh
|
||||
|
|
@ -46,7 +45,7 @@ USER node
|
|||
|
||||
COPY --chown=node:node ./package*.json ./webpack.*.js ./babel.config.js /app/
|
||||
|
||||
RUN --mount=type=cache,uid=1000,gid=1000,target=/home/node/.npm \
|
||||
RUN --mount=type=cache,target=$HOME/.npm \
|
||||
npm ci
|
||||
|
||||
COPY --chown=node:node ./src /app/src
|
||||
|
|
@ -61,7 +60,7 @@ FROM backend AS production
|
|||
COPY --from=frontend-build --chown=newsreader:newsreader \
|
||||
/app/src/newsreader/static /app/src/newsreader/static
|
||||
|
||||
RUN --mount=type=cache,uid=$USER_ID,gid=$GROUP_ID,target=/home/newsreader/.cache/uv \
|
||||
RUN --mount=type=cache,target=$HOME/.cache/uv \
|
||||
uv sync --frozen --only-group production --extra sentry
|
||||
|
||||
COPY --chown=newsreader:newsreader ./src /app/src
|
||||
|
|
@ -76,5 +75,5 @@ RUN uv run --no-sync -- src/manage.py collectstatic --noinput
|
|||
# (optional) stage 4
|
||||
FROM backend AS development
|
||||
|
||||
RUN --mount=type=cache,uid=$USER_ID,gid=$GROUP_ID,target=/home/newsreader/.cache/uv \
|
||||
RUN --mount=type=cache,target=$HOME/.cache/uv \
|
||||
uv sync --frozen --group development
|
||||
|
|
|
|||
|
|
@ -1,3 +1,7 @@
|
|||
import os
|
||||
|
||||
from pathlib import Path
|
||||
|
||||
from dotenv import load_dotenv
|
||||
|
||||
from newsreader.conf.utils import get_env, get_root_dir
|
||||
|
|
@ -182,7 +186,9 @@ USE_TZ = True
|
|||
|
||||
STATIC_URL = "/static/"
|
||||
STATIC_ROOT = BASE_DIR / "static"
|
||||
STATICFILES_DIRS = (DJANGO_PROJECT_DIR / "static",)
|
||||
STATICFILES_DIRS = (
|
||||
DJANGO_PROJECT_DIR / "static",
|
||||
)
|
||||
|
||||
STATICFILES_FINDERS = [
|
||||
"django.contrib.staticfiles.finders.FileSystemFinder",
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ EMAIL_BACKEND = "django.core.mail.backends.console.EmailBackend"
|
|||
INSTALLED_APPS += ["debug_toolbar", "django_extensions"] # noqa: F405
|
||||
|
||||
|
||||
TEMPLATES[0]["OPTIONS"]["context_processors"].append( # noqa: F405
|
||||
TEMPLATES[0]["OPTIONS"]["context_processors"].append(
|
||||
"django.template.context_processors.debug",
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ LOGGING["loggers"].update( # noqa: F405
|
|||
EMAIL_BACKEND = "django.core.mail.backends.console.EmailBackend"
|
||||
|
||||
|
||||
TEMPLATES[0]["OPTIONS"]["context_processors"].append( # noqa: F405
|
||||
TEMPLATES[0]["OPTIONS"]["context_processors"].append(
|
||||
"django.template.context_processors.debug",
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
import os
|
||||
|
||||
from newsreader.conf.utils import get_env
|
||||
|
||||
from .base import * # noqa: F403
|
||||
|
|
@ -9,7 +11,8 @@ DEBUG = False
|
|||
SECURE_PROXY_SSL_HEADER = ("HTTP_X_FORWARDED_PROTO", "https")
|
||||
|
||||
ADMINS = [
|
||||
("", email) for email in get_env("ADMINS", split=",", required=False, default=[])
|
||||
("", email)
|
||||
for email in get_env("ADMINS", split=",", required=False, default=[])
|
||||
]
|
||||
|
||||
# Project settings
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ def get_env(
|
|||
cast: Type = str,
|
||||
required: bool = True,
|
||||
default: Any = None,
|
||||
split: str = "",
|
||||
split: str = ""
|
||||
) -> Any:
|
||||
if cast is not str and split:
|
||||
raise TypeError(f"Split is not possible with {cast}")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue