Compare commits

...

3 Commits

Author SHA1 Message Date
fde087d1ed
aaah 2025-08-12 11:55:12 +12:00
e443c28fc4
i really fucking hate webdev 2025-08-12 11:39:05 +12:00
44bdbaf4c6
Docker actually persists db files now lmao 2025-08-12 11:23:40 +12:00
6 changed files with 25 additions and 7 deletions

4
.env.example Normal file
View File

@ -0,0 +1,4 @@
PB_ADMIN_EMAIL=admin@example.com
PB_ADMIN_PASSWORD=secret-password
PB_URL=http://pocketbase:8080
PB_DATA_DIR=/pb/pb_data

1
.gitignore vendored
View File

@ -7,6 +7,7 @@ node_modules
.wrangler
/.svelte-kit
/build
/data
# OS
.DS_Store

View File

@ -1,7 +1,6 @@
FROM alpine:latest
ARG PB_VERSION=0.29.2
ENV PB_DATA_DIR=/pb_data
WORKDIR /pb
@ -19,6 +18,8 @@ RUN unzip /tmp/pb.zip -d /pb/
COPY docker-entrypoint.sh /usr/local/bin/
RUN chmod +x /usr/local/bin/docker-entrypoint.sh
VOLUME [ "/pb/pb_data", "/pb/pb_migrations", "/pb/pb_hooks" ]
EXPOSE 8080
ENTRYPOINT ["docker-entrypoint.sh"]

View File

@ -7,14 +7,14 @@ set -e
: "${PB_DATA_DIR:?need PB_DATA_DIR}"
# ensure data dir exists (for embedded SQLite + migrations + files)
mkdir -p "${PB_DATA_DIR}"
export POCKETBASE_DATA_DIR="${PB_DATA_DIR}"
# mkdir -p "${PB_DATA_DIR}"
# export POCKETBASE_DATA_DIR="${PB_DATA_DIR}"
# if there are no users yet, create the superuser
# we check the sqlite file for any existing record in the users table
if [ ! -f "${PB_DATA_DIR}/pb_data.db" ] || ! \
sqlite3 "${PB_DATA_DIR}/pb_data.db" \
"SELECT id FROM users WHERE email='${PB_ADMIN_EMAIL}' LIMIT 1;" \
if [ ! -f "${PB_DATA_DIR}/pb_data.db" ] \
! sqlite3 "${PB_DATA_DIR}/data.db" \
"SELECT id FROM _superusers WHERE email='${PB_ADMIN_EMAIL}' LIMIT 1;" \
| grep -q .; then
echo ">>> Creating PocketBase superuser: ${PB_ADMIN_EMAIL}"

View File

@ -9,6 +9,8 @@ services:
build: api
env_file: .env
volumes:
- ./data:/pb_data
- ./data/data:/pb/pb_data
- ./data/migrations:/pb/pb_migrations
- ./data/hooks:/pb/pb_hooks
ports:
- "8080:8080"

View File

@ -1,2 +1,12 @@
<script lang="ts">
import type { PageProps } from "./$types"
let { data }: PageProps = $props()
console.log(data)
</script>
<h1>Welcome to SvelteKit</h1>
<p>Visit <a href="https://svelte.dev/docs/kit">svelte.dev/docs/kit</a> to read the documentation</p>