Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,9 @@ on:
push:
branches: [main]

# Least privilege by default; the image job adds what it needs.
permissions:
contents: read

# A newer push to the same pull request replaces the older run. Runs on main are
# never cancelled, so every merge produces its image.
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
Expand Down Expand Up @@ -39,8 +36,6 @@ jobs:
- run: npm run compile:tests
- run: npx mocha 'dist-tests/tests/**/*.test.js'

# Pull requests build the image and check that it works, without publishing.
# A merge to main also publishes it for amd64 and arm64.
image:
needs: test
runs-on: ubuntu-latest
Expand Down
9 changes: 1 addition & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
# syntax=docker/dockerfile:1

# The editor is a set of static files. The build stage always runs on the build
# machine's own architecture, so building images for several architectures does
# not run Node under emulation; only the final nginx layer is per architecture.
# Runs on the build machine's architecture so multi-architecture builds do not emulate Node.
FROM --platform=$BUILDPLATFORM node:26-alpine AS build
WORKDIR /app

Expand All @@ -15,17 +13,12 @@ COPY assets ./assets
COPY src ./src
RUN npm run compile && npm run copy

# Development-only live reload must not ship. Fail the build if anything is left.
RUN sed -i '/debug\/live-reload\.js/d' dist/index.html \
&& rm -rf dist/debug \
&& ! grep -rq "live-reload" dist

# The slim variant leaves out the optional modules (image filter, XSLT, GeoIP,
# njs) and the libraries they pull in. This site only needs core nginx and gzip,
# and every extra package is extra attack surface.
FROM nginxinc/nginx-unprivileged:stable-alpine-slim
COPY docker/nginx.conf /etc/nginx/conf.d/default.conf
COPY --from=build /app/dist /usr/share/nginx/html

# Runs as a non-root user and listens on 8080.
EXPOSE 8080
5 changes: 1 addition & 4 deletions docker/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,7 @@ server {
location / {
try_files $uri $uri/ =404;

# File names are not content-hashed, so make browsers revalidate. nginx
# answers with 304 when nothing changed. add_header must be repeated
# here because a location that sets any header drops the ones from the
# server block.
# add_header is repeated here: a location that sets any header drops the server-level ones.
add_header Cache-Control "no-cache" always;
add_header X-Content-Type-Options "nosniff" always;
add_header Referrer-Policy "strict-origin-when-cross-origin" always;
Expand Down
Loading