Skip to content

Commit 760d6b1

Browse files
committed
Merge main & update to bikkelhart/internet-nl@87f11734
git fetch bikkelhart git fetch internetnl git merge -X theirs internetnl/main git checkout --no-overlay bikkelhart/bikkelhart-redesign -- frontend interface/templates interface/static translations git checkout --no-overlay main -- interface/static/question@internet.nl_0x45028563.asc convert -resize 48x48 interface/static/favicon.{png,ico} git add interface/static/favicon.ico git rm package{,-lock}.json # manual merge of docker/Dockerfile and docker/compose.development.yaml and fix .gitignore, note: changed *.js copy and base template git commit --amend -m "Merge main & update to bikkelhart/internet-nl@$(git rev-parse bikkelhart/bikkelhart-redesign | cut -c1-8)"
2 parents fe11a50 + 1fa9fb7 commit 760d6b1

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

76 files changed

+4076
-2479
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,4 +83,4 @@ config-compose-*
8383

8484
# Frontend
8585
frontend/node_modules
86-
frontend/build
86+
frontend/dist

checks/tasks/update.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ def _populate_HOF(hof, model, entry_creation):
7676
previousscore = 0
7777
previoustimestamp = None
7878
previousreportid = None
79-
for report in model.objects.all().order_by("domain", "timestamp"):
79+
for report in model.objects.only("id", "domain", "timestamp", "score").order_by("domain", "timestamp").iterator():
8080
if previousname != report.domain and previousname is not None:
8181
if previousscore >= 100:
8282
entry_creation(hof, previousname, previousreportid, previoustimestamp)

docker/Dockerfile

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -134,16 +134,17 @@ USER unbound
134134

135135
ENTRYPOINT ["/entrypoint.sh"]
136136

137-
FROM debian:bullseye-20241111-slim AS frontend
137+
# build frontend image target
138+
FROM --platform=linux/amd64 debian:bullseye-20241111-slim AS frontend
138139

139140
# install npm from official image
140-
COPY --from=node:20-slim /usr/local/bin/ /usr/local/bin/
141-
COPY --from=node:20-slim /usr/local/lib/node_modules /usr/local/lib/node_modules
141+
COPY --from=node:22-slim /usr/local/bin/ /usr/local/bin/
142+
COPY --from=node:22-slim /usr/local/lib/node_modules /usr/local/lib/node_modules
142143

143144
ADD frontend/ /app/frontend
144145
WORKDIR /app/frontend
145146
RUN npm install
146-
RUN npm run css:build
147+
RUN npm run docker:build
147148

148149
# build main application image target
149150
FROM --platform=linux/amd64 debian:bullseye-20241111-slim AS build-app
@@ -216,22 +217,14 @@ RUN install -d -m 0755 -o nobody -g nogroup /app/batch_results
216217
# some js/css files use a separate script to generate minimized versions
217218
# storage these in a place for django to find
218219
RUN mkdir -p /app/static_frontend
219-
# minimize JS files
220-
RUN python3 bin/frontend.py js
221-
# copy build/minimized CSS files from frontand stage
220+
# copy build/minimized CSS files from frontend stage
222221
COPY --from=frontend --chown=nobody:nogroup /app/static_frontend/css/*.css /app/static_frontend/css/
222+
# copy build/minimized JS files from frontend stage
223+
COPY --from=frontend --chown=nobody:nogroup /app/static_frontend/js/ /app/static_frontend/js/
223224

224225
# generate language files
225226
RUN python3 bin/pofiles.py to_django
226227

227-
# copy dependencies to rebuild CSS (postcss)
228-
COPY --from=frontend /usr/local/bin/ /usr/local/bin/
229-
COPY --from=frontend /usr/local/lib/node_modules /usr/local/lib/node_modules
230-
COPY --from=frontend /app/frontend/node_modules /app/frontend/node_modules
231-
232-
# copy browser reload module
233-
COPY --from=linttest-deps /usr/local/lib/python${PYTHON_VERSION}/dist-packages/django_browser_reload /usr/local/lib/python${PYTHON_VERSION}/dist-packages/django_browser_reload
234-
235228
# use fake version to prevent building the next steps when only the version changes
236229
ENV SETUPTOOLS_SCM_PRETEND_VERSION=0.0.0-build0
237230

@@ -249,6 +242,19 @@ ENV SETUPTOOLS_SCM_PRETEND_VERSION=$RELEASE
249242
ENTRYPOINT [ "python3", "./manage.py"]
250243
CMD ["runserver", "0.0.0.0:8080"]
251244

245+
# app image with development tools for better live reloading
246+
FROM app AS app-dev
247+
248+
# required for compose `develop` mode file sync/copy
249+
USER root
250+
251+
# copy dependencies to rebuild CSS (postcss)
252+
COPY --from=frontend /usr/local/bin/ /usr/local/bin/
253+
COPY --from=frontend /usr/local/lib/node_modules /usr/local/lib/node_modules
254+
255+
# copy browser reload module
256+
COPY --from=linttest-deps /usr/local/lib/python${PYTHON_VERSION}/dist-packages/django_browser_reload /usr/local/lib/python${PYTHON_VERSION}/dist-packages/django_browser_reload
257+
252258
# supplement application with unittest, lint dependencies
253259
FROM build-app AS linttest
254260
ARG PYTHON_VERSION

docker/compose.development.yaml

Lines changed: 8 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -17,35 +17,21 @@ services:
1717
environment:
1818
- INTERNETNL_DOMAINNAME
1919

20-
webserver:
21-
build:
22-
context: ..
23-
dockerfile: docker/webserver.Dockerfile
24-
develop:
25-
watch:
26-
# auto rebuild/reload when config files change
27-
- path: ./webserver/
28-
action: rebuild
29-
3020
app:
31-
develop:
32-
watch:
33-
# auto rebuild/reload when CSS/JS changes
34-
- path: ../frontend/js
35-
action: sync+exec
36-
target: /app/frontend/js
37-
exec:
38-
command: python3 bin/frontend.py js
21+
build:
22+
target: app-dev
3923
# use Django runserver for better debug abilities during development
4024
entrypoint: ["/bin/bash"]
4125
# run CSS auto rebuild in the background and start devserver
4226
command:
4327
- "-c"
4428
- >
4529
if [ "$INTERNETNL_AUTORELOAD" = "True" ]; then
46-
# watch CSS files for rebuild
30+
# install npm dependencies and watch CSS and JS files for rebuild
4731
cd /app/frontend;
48-
npm run css:build:watch &
32+
# It's needed to install the rollup linux dependency
33+
npm install;
34+
npm run docker:watch &
4935
cd /app;
5036
# start development server with auto reloading
5137
./manage.py runserver 0.0.0.0:8080
@@ -60,8 +46,8 @@ services:
6046
- ../checks:/app/checks
6147
- ../interface:/app/interface
6248
- ../internetnl:/app/internetnl
63-
# mount CSS files so `css:build:watch` can detect changes an rebuild
64-
- ../frontend/css:/app/frontend/css
49+
# mount frontend files so build tools can detect changes and rebuild
50+
- ../frontend/src:/app/frontend/src
6551

6652
worker:
6753
volumes:

frontend/.stylelintrc.json

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,12 @@
1-
{ "extends": ["stylelint-config-standard"] }
1+
{
2+
"extends": [
3+
"stylelint-config-standard"
4+
],
5+
"rules": {
6+
"selector-type-no-unknown": null,
7+
"selector-pseudo-element-no-unknown": null,
8+
"selector-pseudo-class-no-unknown": null,
9+
"declaration-property-value-no-unknown": null,
10+
"no-descending-specificity": null
11+
}
12+
}

frontend/css/layers.css

Lines changed: 0 additions & 21 deletions
This file was deleted.

frontend/js/action-card-fallback.js

Lines changed: 0 additions & 19 deletions
This file was deleted.

frontend/js/carrousel.js

Lines changed: 0 additions & 27 deletions
This file was deleted.

frontend/js/copy-link.js

Lines changed: 0 additions & 36 deletions
This file was deleted.

frontend/js/functions.js

Lines changed: 0 additions & 51 deletions
This file was deleted.

0 commit comments

Comments
 (0)