thanks for this! overall direction is good but the serve runtime cannot set the headers vite-pwa requires i believe. so just requesting a few changes:
change Dockerfile:
- replace
node:22-alpine -> node:24-alpine
- i think node 24 should be fine as it's the latest LTS
- also
npm install should probably be npm ci --no-audit --no-fund
- replace
node+serve -> caddy:2-alpine
- copy
Caddyfile to /etc/caddy/Caddyfile
- copy
dist to /srv
- expose
8469
FROM node:24-alpine AS build
WORKDIR /app
COPY package.json package-lock.json ./
RUN npm ci --no-audit --no-fund
COPY . .
RUN npm run build
FROM caddy:2-alpine
COPY Caddyfile /etc/caddy/Caddyfile
COPY --from=build /app/dist /srv
EXPOSE 8469
add Caddyfile: (this could also be good pointed to as a general example in the deployment section later, i can do that eventually)
# this config is for docker container: serves built dist that was copied to /srv
:8469 {
root /srv
encode
@updates path / /index.html /sw.js /manifest.webmanifest
header @updates Cache-Control "no-cache"
header /manifest.webmanifest Content-Type "application/manifest+json"
file_server
}
change .dockerignore:
- i think we can drop
**/node_modules and **/.git, the flat node_modules and .git should do
- drop the
build dir (vite outputs dist, or is this for a different thing in docker?)
- drop legacy
npm-debug.log
- ignore
node_modules , dist, .git, result, .direnv, .DS_Store, .env*
node_modules
dist
.git
result
.direnv
.DS_Store
.env*
change docker-compose.yml:
- 8469:8469 port
- add
image: tinysub
- in build, drop seemingly redundant
dockerfile: Dockerfile, and can probably shorten to build: . in that case (docker already looks for Dockerfile by default i belive)
services:
tinysub:
build: .
image: tinysub
ports:
- "8469:8469"
restart: unless-stopped
and readme should also be updated with port 8469 ofc
i went with 8469 because thats the T9 encoding for TINY :p it's less likely to collide with other ports than 3333, but let me know if it should still just stay as 3333