Modular logistics and supply chain operating system (LSOS)
JavaScript driver-appfleet-managementfreight-managementinfrastructureinventory-managementlast-mile-deliverylogisticsondemandopen-sourceorder-managementroute-optimizationsupply-chain-managementtracking-and-monitoringtransport-management-systemtransportationwarehouse-management
Improvements to docker setups
Ronald A. Richardson86da1bd09558
diff --git a/api/EXPECTED_HASH b/api/EXPECTED_HASHnew file mode 100644index 00000000..506cea38--- /dev/null+++ b/api/EXPECTED_HASH@@ -0,0 +1 @@+ae89600ae6433349b62a31a80d8738faf771d0b0diff --git a/docker-bake.hcl b/docker-bake.hclindex 349b363d..0275c3a5 100644--- a/docker-bake.hcl+++ b/docker-bake.hcl@@ -68,6 +68,7 @@ target "fleetbase-console" {target "fleetbase-api" {context = "./"dockerfile = "docker/Dockerfile"+ target = "app-release"platforms = ["linux/amd64"]tags = notequal("", REGISTRY) ? formatlist(diff --git a/docker-compose.yml b/docker-compose.ymlindex 7ec71bd7..7037dfce 100644--- a/docker-compose.yml+++ b/docker-compose.yml@@ -31,13 +31,20 @@ services:SOCKETCLUSTER_WORKERS: 10SOCKETCLUSTER_BROKERS: 10+ scheduler:+ image: fleetbase/fleetbase-api:v0.7.0+ command: ["go-crond", "--verbose", "root:./crontab"]+ environment:+ DATABASE_URL: "mysql://root@database/fleetbase"+ QUEUE_CONNECTION: redis+ CACHE_DRIVER: redis+ CACHE_PATH: /fleetbase/api/storage/framework/cache+ CACHE_URL: tcp://cache+ REDIS_URL: tcp://cache+queue:- build:- context: .- dockerfile: docker/Dockerfile- target: events-dev- args:- ENVIRONMENT: development+ image: fleetbase/fleetbase-api:v0.7.0+ command: ["php", "artisan", "queue:work"]healthcheck:test: ["CMD", "php", "artisan", "queue:status"]interval: 30s@@ -52,21 +59,14 @@ services:REDIS_URL: tcp://cacheconsole:- build:- context: ./console- dockerfile: Dockerfile- args:- ENVIRONMENT: development+ image: fleetbase/fleetbase-console:v0.7.0ports:- "4200:4200"+ volumes:+ - ./docker/fleetbase.config.json:/usr/share/nginx/html/fleetbase.config.jsonapplication:- build:- context: .- dockerfile: docker/Dockerfile- target: app-dev- args:- ENVIRONMENT: development+ image: fleetbase/fleetbase-api:v0.7.0environment:ENVIRONMENT: developmentDATABASE_URL: "mysql://root@database/fleetbase"diff --git a/docker/Dockerfile b/docker/Dockerfileindex a8f7c31c..2c431eaf 100644--- a/docker/Dockerfile+++ b/docker/Dockerfile@@ -75,6 +75,7 @@ ENV QUEUE_CONNECTION=redisENV CADDYFILE_PATH=/fleetbase/CaddyfileENV CONSOLE_PATH=/fleetbase/consoleENV OCTANE_SERVER=frankenphp+ENV FLEETBASE_VERSION=0.7.1# Set environmentARG ENVIRONMENT=production@@ -89,6 +90,16 @@ COPY --chown=www-data:www-data ./Caddyfile $CADDYFILE_PATH# Create /fleetbase directory and set correct permissionsRUN mkdir -p /fleetbase/api && mkdir -p /fleetbase/console && chown -R www-data:www-data /fleetbase+# Generate and store a UUID in .fleetbase-id+RUN uuidgen > /fleetbase/api/.fleetbase-id++# Export the same ID as an environment variable for use in the container+RUN export FLEETBASE_INSTANCE_ID=$(cat /fleetbase/api/.fleetbase-id) && \+ echo "FLEETBASE_INSTANCE_ID=$FLEETBASE_INSTANCE_ID" >> /etc/environment++# Track commit hash+RUN git rev-parse HEAD > /fleetbase/CURRENT_HASH+# Set working directoryWORKDIR /fleetbase/api@@ -153,7 +164,12 @@ CMD ["php", "artisan", "queue:work"]# Application dev stageFROM base AS app-devENTRYPOINT ["docker-php-entrypoint"]-CMD ["sh", "-c", "php artisan octane:frankenphp --max-requests=250 --port=8000 --host=0.0.0.0 --watch"]+CMD ["sh", "-c", "php artisan octane:frankenphp --max-requests=250 --port=8000 --host=0.0.0.0 --watch"]++# Application release stage+FROM base AS app-release+ENTRYPOINT ["docker-php-entrypoint"]+CMD ["sh", "-c", "php artisan octane:frankenphp --max-requests=250 --port=8000 --host=0.0.0.0"]# Application stageFROM base AS appdiff --git a/scripts/pre-commit-hook.sh b/scripts/pre-commit-hook.shnew file mode 100644index 00000000..51e3f0e6--- /dev/null+++ b/scripts/pre-commit-hook.sh@@ -0,0 +1,14 @@+#!/bin/sh++CURRENT_HASH_FILE="./EXPECTED_HASH"+CURRENT_HASH=$(git rev-parse HEAD)+EXISTING_HASH=$(cat "$CURRENT_HASH_FILE" 2>/dev/null || echo "")++if [ "$CURRENT_HASH" = "$EXISTING_HASH" ]; then+ echo "✅ EXPECTED_HASH is already up to date."+ exit 0+fi++echo "⚙️ Writing current commit hash to CURRENT_HASH..."+echo "$CURRENT_HASH" > "$CURRENT_HASH_FILE"+git add "$CURRENT_HASH_FILE"\ No newline at end of filediff --git a/scripts/setup-hooks.sh b/scripts/setup-hooks.shnew file mode 100644index 00000000..8ca29a2f--- /dev/null+++ b/scripts/setup-hooks.sh@@ -0,0 +1,5 @@+#!/bin/bash++cp ./scripts/pre-commit-hook.sh .git/hooks/pre-commit+chmod +x .git/hooks/pre-commit+echo "✅ Git hook installed."\ No newline at end of file