add pb stuff
This commit is contained in:
1
pb/.gitignore
vendored
Normal file
1
pb/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
pb_data
|
||||
27
pb/Dockerfile
Normal file
27
pb/Dockerfile
Normal file
@@ -0,0 +1,27 @@
|
||||
FROM alpine:latest
|
||||
|
||||
ARG PB_VERSION=0.29.2
|
||||
|
||||
WORKDIR /pb
|
||||
|
||||
RUN apk add --no-cache \
|
||||
unzip \
|
||||
curl \
|
||||
ca-certificates \
|
||||
bash \
|
||||
sqlite
|
||||
|
||||
# download and unzip PocketBase
|
||||
ADD https://github.com/pocketbase/pocketbase/releases/download/v${PB_VERSION}/pocketbase_${PB_VERSION}_linux_amd64.zip /tmp/pb.zip
|
||||
RUN unzip /tmp/pb.zip -d /pb/
|
||||
|
||||
# copy entrypoint
|
||||
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 8090
|
||||
|
||||
ENTRYPOINT ["docker-entrypoint.sh"]
|
||||
CMD ["serve", "--http=0.0.0.0:8090"]
|
||||
17
pb/docker-entrypoint.sh
Normal file
17
pb/docker-entrypoint.sh
Normal file
@@ -0,0 +1,17 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
|
||||
# if there are no users yet, create the superuser
|
||||
# we check the sqlite file for any existing record in the users table
|
||||
# /pb/pocketbase superuser create "${PB_ADMIN_EMAIL}" "${PB_ADMIN_PASSWORD}"
|
||||
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}"
|
||||
/pb/pocketbase superuser create "${PB_ADMIN_EMAIL}" "${PB_ADMIN_PASSWORD}"
|
||||
else
|
||||
echo ">>> Superuser ${PB_ADMIN_EMAIL} already exists, skipping creation."
|
||||
fi
|
||||
|
||||
# exec the real pocketbase binary with any passed arguments
|
||||
exec /pb/pocketbase "$@"
|
||||
89
pb/pb_migrations/1763339755_created_recipes.js
Normal file
89
pb/pb_migrations/1763339755_created_recipes.js
Normal file
@@ -0,0 +1,89 @@
|
||||
/// <reference path="../pb_data/types.d.ts" />
|
||||
migrate((app) => {
|
||||
const collection = new Collection({
|
||||
"createRule": null,
|
||||
"deleteRule": null,
|
||||
"fields": [
|
||||
{
|
||||
"autogeneratePattern": "[a-z0-9]{15}",
|
||||
"hidden": false,
|
||||
"id": "text3208210256",
|
||||
"max": 15,
|
||||
"min": 15,
|
||||
"name": "id",
|
||||
"pattern": "^[a-z0-9]+$",
|
||||
"presentable": false,
|
||||
"primaryKey": true,
|
||||
"required": true,
|
||||
"system": true,
|
||||
"type": "text"
|
||||
},
|
||||
{
|
||||
"autogeneratePattern": "",
|
||||
"hidden": false,
|
||||
"id": "text1102439568",
|
||||
"max": 0,
|
||||
"min": 0,
|
||||
"name": "cooklang",
|
||||
"pattern": "",
|
||||
"presentable": false,
|
||||
"primaryKey": false,
|
||||
"required": false,
|
||||
"system": false,
|
||||
"type": "text"
|
||||
},
|
||||
{
|
||||
"hidden": false,
|
||||
"id": "file3760176746",
|
||||
"maxSelect": 99,
|
||||
"maxSize": 0,
|
||||
"mimeTypes": [
|
||||
"image/png",
|
||||
"image/jpeg",
|
||||
"image/vnd.mozilla.apng"
|
||||
],
|
||||
"name": "images",
|
||||
"presentable": false,
|
||||
"protected": false,
|
||||
"required": false,
|
||||
"system": false,
|
||||
"thumbs": [],
|
||||
"type": "file"
|
||||
},
|
||||
{
|
||||
"hidden": false,
|
||||
"id": "autodate2990389176",
|
||||
"name": "created",
|
||||
"onCreate": true,
|
||||
"onUpdate": false,
|
||||
"presentable": false,
|
||||
"system": false,
|
||||
"type": "autodate"
|
||||
},
|
||||
{
|
||||
"hidden": false,
|
||||
"id": "autodate3332085495",
|
||||
"name": "updated",
|
||||
"onCreate": true,
|
||||
"onUpdate": true,
|
||||
"presentable": false,
|
||||
"system": false,
|
||||
"type": "autodate"
|
||||
}
|
||||
],
|
||||
"id": "pbc_842702175",
|
||||
"indexes": [],
|
||||
"listRule": null,
|
||||
"name": "recipes",
|
||||
"system": false,
|
||||
"type": "base",
|
||||
"updateRule": null,
|
||||
"viewRule": null
|
||||
});
|
||||
|
||||
return app.save(collection);
|
||||
}, (app) => {
|
||||
const collection = app.findCollectionByNameOrId("pbc_842702175");
|
||||
|
||||
return app.delete(collection);
|
||||
})
|
||||
Reference in New Issue
Block a user