Skip to content
Snippets Groups Projects
Commit 99938fec authored by ale's avatar ale
Browse files

Process templates with Webpack

Allows us to embed the content checksum in the asset URLs, to
avoid caching issues. We also add SRI while we're at it.
parent 6b505277
Branches
No related tags found
No related merge requests found
Showing
with 18 additions and 16 deletions
Dockerfile
assets
build build
node_modules node_modules
package-lock.json
.git .git
...@@ -11,3 +11,5 @@ data.json ...@@ -11,3 +11,5 @@ data.json
test-httpd.pid test-httpd.pid
test-httpd.log test-httpd.log
node_modules node_modules
assets
package-lock.json
FROM node:current-buster AS assets FROM node:current-bullseye AS assets
ADD . /src ADD . /src
WORKDIR /src WORKDIR /src
RUN npm install && ./node_modules/.bin/webpack RUN npm install && env NODE_OPTIONS=--openssl-legacy-provider ./node_modules/.bin/webpack
# Debian bullseye can't build gostatic due to its strict dependency # Debian bullseye can't build gostatic due to its strict dependency
# on Go 1.16, so we build it separately. # on Go 1.17, so we build it separately.
FROM golang:1.16 AS gobuild FROM golang:1.17 AS gobuild
RUN go get github.com/piranha/gostatic RUN go get github.com/piranha/gostatic
RUN go get git.autistici.org/ai/webtools/cmd/sitesearch RUN go get git.autistici.org/ai/webtools/cmd/sitesearch
RUN go get git.autistici.org/ai/webtools/cmd/jsonsubst RUN go get git.autistici.org/ai/webtools/cmd/jsonsubst
FROM debian:bullseye AS build FROM debian:bullseye-slim AS build
RUN apt-get -q update && env DEBIAN_FRONTEND=noninteractive apt-get -qy install --no-install-recommends rsync RUN apt-get -q update && env DEBIAN_FRONTEND=noninteractive apt-get -qy install --no-install-recommends rsync
ADD . /src ADD . /src
WORKDIR /src WORKDIR /src
COPY --from=gobuild /go/bin/gostatic /usr/bin/gostatic COPY --from=gobuild /go/bin/gostatic /usr/bin/gostatic
COPY --from=gobuild /go/bin/sitesearch /usr/bin/sitesearch COPY --from=gobuild /go/bin/sitesearch /usr/bin/sitesearch
COPY --from=gobuild /go/bin/jsonsubst /usr/bin/jsonsubst COPY --from=gobuild /go/bin/jsonsubst /usr/bin/jsonsubst
COPY --from=assets /src/assets/templates/ /src/assets/templates/
RUN ./scripts/lint.sh && ./scripts/update.sh RUN ./scripts/lint.sh && ./scripts/update.sh
FROM registry.git.autistici.org/ai3/docker/apache2-base:s6 FROM registry.git.autistici.org/ai3/docker/apache2-base:s6
COPY --from=build /src/public /var/www/autistici.org COPY --from=build /src/public /var/www/autistici.org
COPY --from=gobuild /go/bin/sitesearch /usr/sbin/sitesearch COPY --from=gobuild /go/bin/sitesearch /usr/sbin/sitesearch
COPY --from=build /src/index /var/lib/sitesearch/index COPY --from=build /src/index /var/lib/sitesearch/index
COPY --from=assets /src/static/ /var/www/autistici.org/static/ COPY --from=assets /src/assets/static/ /var/www/autistici.org/static/
COPY templates /var/lib/sitesearch/templates COPY --from=assets /src/assets/templates/ /var/lib/sitesearch/templates/
COPY static/ /var/www/autistici.org/static/
COPY docker/conf/ /etc/ COPY docker/conf/ /etc/
COPY docker/build.sh /tmp/build.sh COPY docker/build.sh /tmp/build.sh
......
TEMPLATES = templates TEMPLATES = assets/templates
SOURCE = src SOURCE = src
OUTPUT = public OUTPUT = public
......
ai.css
ai.js*
*.eot
*.otf
*.ttf
*.svg
*.woff
File moved
File moved
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment