diff --git a/Dockerfile b/Dockerfile index d4b365e..6238d26 100644 --- a/Dockerfile +++ b/Dockerfile @@ -81,6 +81,12 @@ ENV WEB_DIST=/app/web/dist ENV CONNECTOR_BIN=/app/connector-bin/ts-connector EXPOSE 8080 +# Run unprivileged. /app itself is the default spot for feedback.log and +# store-themes.json, so it has to be writable by that user; a volume mounted +# there from an older (root) image may need a one-off `chown 1000:1000`. +RUN chown node:node /app +USER node + HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \ CMD ["node", "-e", "fetch('http://127.0.0.1:8080/healthz').then(r => { if (!r.ok) process.exit(1) }).catch(() => process.exit(1))"] diff --git a/docker-compose.yml b/docker-compose.yml index ea8568f..fe90c55 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -6,6 +6,10 @@ services: restart: unless-stopped environment: - PORT=8080 + # Nothing in here needs Linux capabilities (unprivileged port, plain + # TCP/UDP sockets), so drop them all. + cap_drop: [ALL] + security_opt: [no-new-privileges:true] # Port publishing is deployment-specific and left out of this file on # purpose - Compose concatenates `ports:` lists across an override file # instead of replacing them, so adding one here would double-publish