``refactor Update docker-compose configurations, adjust PocketBase Dockerfile, modify seed scripts to use 'state' instead of 'status', and fix paths in development scripts ``

This commit is contained in:
2025-05-16 11:13:14 +08:00
parent a8b0a63648
commit 3e3e23aa68
5 changed files with 32 additions and 21 deletions

View File

@@ -1,3 +1,6 @@
# related to ./scripts/dc_dev.sh
# consider we are starting in project/002_source/docker, see dc_dev.sh
volumes:
shared:
dist:
@@ -16,10 +19,14 @@ services:
ports:
- 8090:8090
volumes:
# group custom persistant data inside docker directory
- ./volumes/pocketbase/pb_data:/pb_data
#
# group dev, seed, schemas into pocketbase dirctory
- ../pocketbase/pb_migrations:/pb_migrations
- ../pocketbase/pb_hooks:/pb_hooks
# TODO: resume healthcheck in prod
# healthcheck:
# #optional (recommended) since v0.10.0
# test: wget --no-verbose --tries=1 --spider http://localhost:8090/api/health || exit 1
@@ -30,6 +37,6 @@ services:
deploy:
resources:
limits:
cpus: 0.5
cpus: 0.1
reservations:
cpus: 0.01

View File

@@ -1,4 +1,4 @@
FROM alpine:3 as downloader
FROM alpine:3 AS downloader
ARG TARGETOS
ARG TARGETARCH
@@ -7,24 +7,28 @@ ARG VERSION
ENV BUILDX_ARCH="${TARGETOS:-linux}_${TARGETARCH:-amd64}${TARGETVARIANT}"
RUN wget https://github.com/pocketbase/pocketbase/releases/download/v${VERSION}/pocketbase_${VERSION}_${BUILDX_ARCH}.zip \
&& unzip pocketbase_${VERSION}_${BUILDX_ARCH}.zip \
&& chmod +x /pocketbase
RUN wget https://github.com/pocketbase/pocketbase/releases/download/v${VERSION}/pocketbase_${VERSION}_${BUILDX_ARCH}.zip && \
unzip pocketbase_${VERSION}_${BUILDX_ARCH}.zip && \
chmod +x /pocketbase
FROM alpine:3
RUN apk update && apk add ca-certificates && rm -rf /var/cache/apk/*
RUN apk update && \
apk add ca-certificates && \
rm -rf /var/cache/apk/*
EXPOSE 8090
COPY --from=downloader /pocketbase /usr/local/bin/pocketbase
ENTRYPOINT [
"/usr/local/bin/pocketbase", "serve", "--http=0.0.0.0:8090", "--dir=/pb_data", "--publicDir=/pb_public", "--hooksDir=/pb_hooks"]
# ---
RUN apk add sqlite entr
# RUN apk add sqlite entr
COPY entrypoint.sh /entrypoint.sh
# ENTRYPOINT ["/entrypoint.sh"]
# # COPY entrypoint.sh /entrypoint.sh
# # ENTRYPOINT ["/entrypoint.sh"]
RUN apk add nodejs yarn
RUN yarn global add nodemon
ENTRYPOINT ["/usr/local/bin/pocketbase", "serve", "--http=0.0.0.0:8090", "--dir=/pb_data", "--publicDir=/pb_public", "--hooksDir=/pb_hooks"]
# RUN apk add nodejs yarn
# RUN yarn global add nodemon

View File

@@ -143,7 +143,7 @@ module.exports = ($app) => {
record.set("timezone", customer[8]);
record.set("language", customer[9]);
record.set("currency", customer[10]);
record.set("status", customer[11]);
record.set("state", customer[11]);
$app.save(record);
}

View File

@@ -143,7 +143,7 @@ module.exports = ($app) => {
record.set("timezone", student[8]);
record.set("language", student[9]);
record.set("currency", student[10]);
record.set("status", student[11]);
record.set("state", student[11]);
$app.save(record);
}

View File

@@ -1,14 +1,14 @@
#!/usr/bin/env bash
DB_COMPOSE_FILE="-f ./docker-compose.db.yml"
_COMPOSE_FILE="-f ./docker-compose.yml"
DEV_COMPOSE_FILE="-f ./docker-compose.dev.yml"
DB_COMPOSE_FILE="-f ./docker/docker-compose.db.yml"
_COMPOSE_FILE="-f ./docker/docker-compose.yml"
DEV_COMPOSE_FILE="-f ./docker/docker-compose.dev.yml"
COMPOSE_FILES="$DB_COMPOSE_FILE $_COMPOSE_FILE $DEV_COMPOSE_FILE"
set -x
cd docker
# cd docker
docker compose $COMPOSE_FILES kill
docker compose $COMPOSE_FILES down
@@ -21,11 +21,11 @@ docker compose $COMPOSE_FILES logs pocketbase
echo "done"
sudo chown 1000:1000 -R ./volumes
sudo chown 1000:1000 -R ./docker/volumes
echo "please run yourself !!!!"
echo "nodemon -w /pb_hooks --exec "pocketbase seed""
echo ""
docker compose $COMPOSE_FILES exec -it pocketbase sh
cd ..
# cd ..