fix: run PocketBase as root so it can write Coolify's persistent mount
Coolify attaches a root-owned volume/bind at /pb_data; the non-root pb user couldn't write it, so SQLite failed with "unable to open database file (14)". Drop the pb user and run as root. Verified against a root-owned bind mount locally: server starts clean, migrations apply, data.db persists to the mount. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
24d59c3f91
commit
cf299e06dd
1 changed files with 6 additions and 6 deletions
12
Dockerfile
12
Dockerfile
|
|
@ -15,21 +15,21 @@ RUN apk add --no-cache ca-certificates unzip wget \
|
||||||
|
|
||||||
FROM alpine:3.20
|
FROM alpine:3.20
|
||||||
|
|
||||||
RUN apk add --no-cache ca-certificates \
|
RUN apk add --no-cache ca-certificates
|
||||||
&& adduser -D -H -u 10001 pb
|
|
||||||
|
|
||||||
COPY --from=fetch /pb/pocketbase /usr/local/bin/pocketbase
|
COPY --from=fetch /pb/pocketbase /usr/local/bin/pocketbase
|
||||||
|
|
||||||
# Schema-as-code: migrations are baked in and auto-applied on serve.
|
# Schema-as-code: migrations are baked in and auto-applied on serve.
|
||||||
COPY pb_migrations /pb_migrations
|
COPY pb_migrations /pb_migrations
|
||||||
|
|
||||||
# Persist DB, uploaded files, and any admin-created migrations here. Create it
|
# Persist DB, uploaded files, and any admin-created migrations here. Runs as root
|
||||||
# owned by the runtime user so a fresh named volume inherits writable perms.
|
# so it can always write the volume Coolify attaches — Coolify's persistent mount
|
||||||
RUN mkdir -p /pb_data && chown pb /pb_data
|
# is root-owned, and a non-root user hitting it fails with SQLite "unable to open
|
||||||
|
# database file (14)".
|
||||||
|
RUN mkdir -p /pb_data
|
||||||
VOLUME ["/pb_data"]
|
VOLUME ["/pb_data"]
|
||||||
|
|
||||||
EXPOSE 8090
|
EXPOSE 8090
|
||||||
USER pb
|
|
||||||
|
|
||||||
# Coolify terminates TLS at Traefik; PocketBase listens plain on 8090 behind it.
|
# Coolify terminates TLS at Traefik; PocketBase listens plain on 8090 behind it.
|
||||||
ENTRYPOINT ["pocketbase"]
|
ENTRYPOINT ["pocketbase"]
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue