fix(docker): make deploy/docker/Dockerfile actually build and run#8
Open
prenansantana wants to merge 2 commits into
Open
Conversation
The Dockerfile copies only package*.json before running `npm ci`, but the postinstall hook executes `node scripts/download-pocketbase.js`. Since scripts/ has not been copied yet, npm ci fails with MODULE_NOT_FOUND and the build aborts. Copy scripts/ before npm ci so postinstall succeeds. The rest of the source is still copied afterward to preserve layer caching for the dependency install step.
start.sh has a #!/bin/bash shebang and uses bash-specific syntax
({1..30} brace expansion and `wait -n`), plus calls curl to wait
for PocketBase health. The node:20-alpine base image ships neither
bash nor curl, so the container fails immediately at runtime with
"./start.sh: not found" (ENOENT on the shebang interpreter).
Install bash and curl via apk so start.sh runs as authored.
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two independent bugs in
deploy/docker/Dockerfileblock every Docker deploy from this file (and any PaaS that builds from it — Coolify, Railway-via-Dockerfile, etc). Both fixes together are needed to get a usable image.Bug 1 —
npm cifails becausepostinstallcan't find its scriptThe Dockerfile copies only
package*.jsonbefore runningnpm ci, but thepostinstallhook executesnode scripts/download-pocketbase.js. At that pointscripts/is not in the image, so npm aborts:```
Missing Svelte config file in /app — skipping
Error: Cannot find module '/app/scripts/download-pocketbase.js'
```
Fix: copy
scripts/beforenpm ci.Bug 2 — container crash-loops with
./start.sh: not founddeploy/railway/start.shhas a#!/bin/bashshebang and uses bash-specific syntax ({1..30}brace expansion,wait -n), plus callscurlto wait for PocketBase to become healthy.node:20-alpineships neither bash nor curl, so the container fails immediately at runtime:```
/usr/local/bin/docker-entrypoint.sh: exec: line 11: ./start.sh: not found
```
This message is misleading — the file exists and is executable. The error is ENOENT on the shebang interpreter (
/bin/bash).Switching the shebang to
#!/bin/shis not viable because BusyBoxshdoesn't support the bash features the script uses.Fix: install bash and curl via apk.
Diff
```diff
FROM node:20-alpine
+RUN apk add --no-cache bash curl
+
WORKDIR /app
Install dependencies
COPY package*.json ./
+COPY scripts ./scripts
RUN npm ci --production=false
```
Verified
Built and ran the image locally on linux/arm64. Container starts cleanly:
```
Starting tinykit...
Starting Pocketbase...
Pocketbase is ready!
Superuser ready!
Starting SvelteKit server...
Listening on http://0.0.0.0:3000
```
GET /tinykit→ HTTP 200.Test plan
docker build -f deploy/docker/Dockerfile -t tinykit .completesGET /tinykitreturns 200