split delivery into standalone dockerized service
This commit is contained in:
@@ -1,15 +0,0 @@
|
||||
FROM node:22-bookworm-slim
|
||||
|
||||
WORKDIR /app/delivery
|
||||
|
||||
COPY package*.json ./
|
||||
# Worker does not need Nuxt postinstall hooks.
|
||||
RUN npm install --ignore-scripts --legacy-peer-deps
|
||||
|
||||
COPY . .
|
||||
|
||||
RUN npx prisma generate
|
||||
|
||||
ENV NODE_ENV=production
|
||||
|
||||
CMD ["npm", "run", "worker:delivery"]
|
||||
@@ -14,7 +14,6 @@
|
||||
"postinstall": "nuxt prepare && prisma generate",
|
||||
"preview": "nuxt preview",
|
||||
"typecheck": "nuxt typecheck",
|
||||
"worker:delivery": "tsx server/queues/worker.ts",
|
||||
"codegen": "graphql-codegen --config codegen.ts",
|
||||
"storybook": "storybook dev -p 6006",
|
||||
"storybook:build": "storybook build"
|
||||
|
||||
@@ -1,29 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
cd "$(dirname "$0")/.."
|
||||
|
||||
# Worker container starts from clean image.
|
||||
# Install deps without frontend postinstall hooks (nuxt prepare) to keep worker lean/stable.
|
||||
npm install --ignore-scripts --legacy-peer-deps
|
||||
ARCH="$(uname -m)"
|
||||
if [ "$ARCH" = "aarch64" ] || [ "$ARCH" = "arm64" ]; then
|
||||
npm rebuild sharp --platform=linux --arch=arm64v8 \
|
||||
|| npm rebuild sharp --platform=linux --arch=arm64 \
|
||||
|| npm install sharp --platform=linux --arch=arm64v8 --save-exact=false \
|
||||
|| npm install sharp --platform=linux --arch=arm64 --save-exact=false
|
||||
elif [ "$ARCH" = "x86_64" ] || [ "$ARCH" = "amd64" ]; then
|
||||
npm rebuild sharp --platform=linux --arch=x64 \
|
||||
|| npm install sharp --platform=linux --arch=x64 --save-exact=false
|
||||
else
|
||||
npm rebuild sharp || true
|
||||
fi
|
||||
npx prisma generate
|
||||
|
||||
# Ensure DB is reachable before the worker starts consuming jobs.
|
||||
until node -e "const u=new URL(process.env.DATABASE_URL||''); const net=require('net'); const s=net.createConnection({host:u.hostname,port:Number(u.port||5432)}); s.on('connect',()=>{s.end(); process.exit(0);}); s.on('error',()=>process.exit(1));" ; do
|
||||
echo "Waiting for PostgreSQL..."
|
||||
sleep 1
|
||||
done
|
||||
|
||||
exec npm run worker:delivery
|
||||
Reference in New Issue
Block a user