``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:
@@ -1,3 +1,6 @@
|
|||||||
|
# related to ./scripts/dc_dev.sh
|
||||||
|
# consider we are starting in project/002_source/docker, see dc_dev.sh
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
shared:
|
shared:
|
||||||
dist:
|
dist:
|
||||||
@@ -16,10 +19,14 @@ services:
|
|||||||
ports:
|
ports:
|
||||||
- 8090:8090
|
- 8090:8090
|
||||||
volumes:
|
volumes:
|
||||||
|
# group custom persistant data inside docker directory
|
||||||
- ./volumes/pocketbase/pb_data:/pb_data
|
- ./volumes/pocketbase/pb_data:/pb_data
|
||||||
#
|
#
|
||||||
|
# group dev, seed, schemas into pocketbase dirctory
|
||||||
- ../pocketbase/pb_migrations:/pb_migrations
|
- ../pocketbase/pb_migrations:/pb_migrations
|
||||||
- ../pocketbase/pb_hooks:/pb_hooks
|
- ../pocketbase/pb_hooks:/pb_hooks
|
||||||
|
|
||||||
|
# TODO: resume healthcheck in prod
|
||||||
# healthcheck:
|
# healthcheck:
|
||||||
# #optional (recommended) since v0.10.0
|
# #optional (recommended) since v0.10.0
|
||||||
# test: wget --no-verbose --tries=1 --spider http://localhost:8090/api/health || exit 1
|
# test: wget --no-verbose --tries=1 --spider http://localhost:8090/api/health || exit 1
|
||||||
@@ -30,6 +37,6 @@ services:
|
|||||||
deploy:
|
deploy:
|
||||||
resources:
|
resources:
|
||||||
limits:
|
limits:
|
||||||
cpus: 0.5
|
cpus: 0.1
|
||||||
reservations:
|
reservations:
|
||||||
cpus: 0.01
|
cpus: 0.01
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
FROM alpine:3 as downloader
|
FROM alpine:3 AS downloader
|
||||||
|
|
||||||
ARG TARGETOS
|
ARG TARGETOS
|
||||||
ARG TARGETARCH
|
ARG TARGETARCH
|
||||||
@@ -7,24 +7,28 @@ ARG VERSION
|
|||||||
|
|
||||||
ENV BUILDX_ARCH="${TARGETOS:-linux}_${TARGETARCH:-amd64}${TARGETVARIANT}"
|
ENV BUILDX_ARCH="${TARGETOS:-linux}_${TARGETARCH:-amd64}${TARGETVARIANT}"
|
||||||
|
|
||||||
RUN wget https://github.com/pocketbase/pocketbase/releases/download/v${VERSION}/pocketbase_${VERSION}_${BUILDX_ARCH}.zip \
|
RUN wget https://github.com/pocketbase/pocketbase/releases/download/v${VERSION}/pocketbase_${VERSION}_${BUILDX_ARCH}.zip && \
|
||||||
&& unzip pocketbase_${VERSION}_${BUILDX_ARCH}.zip \
|
unzip pocketbase_${VERSION}_${BUILDX_ARCH}.zip && \
|
||||||
&& chmod +x /pocketbase
|
chmod +x /pocketbase
|
||||||
|
|
||||||
FROM alpine:3
|
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
|
EXPOSE 8090
|
||||||
|
|
||||||
COPY --from=downloader /pocketbase /usr/local/bin/pocketbase
|
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
|
# # COPY entrypoint.sh /entrypoint.sh
|
||||||
# ENTRYPOINT ["/entrypoint.sh"]
|
# # ENTRYPOINT ["/entrypoint.sh"]
|
||||||
|
|
||||||
RUN apk add nodejs yarn
|
# RUN apk add nodejs yarn
|
||||||
RUN yarn global add nodemon
|
# 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"]
|
|
||||||
|
@@ -143,7 +143,7 @@ module.exports = ($app) => {
|
|||||||
record.set("timezone", customer[8]);
|
record.set("timezone", customer[8]);
|
||||||
record.set("language", customer[9]);
|
record.set("language", customer[9]);
|
||||||
record.set("currency", customer[10]);
|
record.set("currency", customer[10]);
|
||||||
record.set("status", customer[11]);
|
record.set("state", customer[11]);
|
||||||
|
|
||||||
$app.save(record);
|
$app.save(record);
|
||||||
}
|
}
|
||||||
|
@@ -143,7 +143,7 @@ module.exports = ($app) => {
|
|||||||
record.set("timezone", student[8]);
|
record.set("timezone", student[8]);
|
||||||
record.set("language", student[9]);
|
record.set("language", student[9]);
|
||||||
record.set("currency", student[10]);
|
record.set("currency", student[10]);
|
||||||
record.set("status", student[11]);
|
record.set("state", student[11]);
|
||||||
|
|
||||||
$app.save(record);
|
$app.save(record);
|
||||||
}
|
}
|
||||||
|
@@ -1,14 +1,14 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
DB_COMPOSE_FILE="-f ./docker-compose.db.yml"
|
DB_COMPOSE_FILE="-f ./docker/docker-compose.db.yml"
|
||||||
_COMPOSE_FILE="-f ./docker-compose.yml"
|
_COMPOSE_FILE="-f ./docker/docker-compose.yml"
|
||||||
DEV_COMPOSE_FILE="-f ./docker-compose.dev.yml"
|
DEV_COMPOSE_FILE="-f ./docker/docker-compose.dev.yml"
|
||||||
|
|
||||||
COMPOSE_FILES="$DB_COMPOSE_FILE $_COMPOSE_FILE $DEV_COMPOSE_FILE"
|
COMPOSE_FILES="$DB_COMPOSE_FILE $_COMPOSE_FILE $DEV_COMPOSE_FILE"
|
||||||
|
|
||||||
set -x
|
set -x
|
||||||
|
|
||||||
cd docker
|
# cd docker
|
||||||
|
|
||||||
docker compose $COMPOSE_FILES kill
|
docker compose $COMPOSE_FILES kill
|
||||||
docker compose $COMPOSE_FILES down
|
docker compose $COMPOSE_FILES down
|
||||||
@@ -21,11 +21,11 @@ docker compose $COMPOSE_FILES logs pocketbase
|
|||||||
|
|
||||||
echo "done"
|
echo "done"
|
||||||
|
|
||||||
sudo chown 1000:1000 -R ./volumes
|
sudo chown 1000:1000 -R ./docker/volumes
|
||||||
|
|
||||||
echo "please run yourself !!!!"
|
echo "please run yourself !!!!"
|
||||||
echo "nodemon -w /pb_hooks --exec "pocketbase seed""
|
echo "nodemon -w /pb_hooks --exec "pocketbase seed""
|
||||||
echo ""
|
echo ""
|
||||||
docker compose $COMPOSE_FILES exec -it pocketbase sh
|
docker compose $COMPOSE_FILES exec -it pocketbase sh
|
||||||
|
|
||||||
cd ..
|
# cd ..
|
||||||
|
Reference in New Issue
Block a user