infra: add persistent uploads volume and configure Caddy to serve static images
- Add named Docker volume `uploads` mounted at /app/public/uploads in app container - Share same volume with Caddy at /srv/uploads for direct static file serving - Add Caddy `handle /uploads/*` block so images bypass Next.js (standalone mode does not serve runtime public files) - Create uploads directory with correct nextjs:nodejs ownership in Dockerfile - Add mkdir safeguard in entrypoint.sh
This commit is contained in:
@@ -31,6 +31,7 @@ COPY --from=builder /app/scripts ./scripts
|
||||
COPY entrypoint.sh ./
|
||||
RUN chmod +x entrypoint.sh
|
||||
RUN apk add --no-cache postgresql-client openssl
|
||||
RUN mkdir -p /app/public/uploads && chown nextjs:nodejs /app/public/uploads
|
||||
USER nextjs
|
||||
EXPOSE 3000
|
||||
ENTRYPOINT ["./entrypoint.sh"]
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
mkdir -p /app/public/uploads
|
||||
|
||||
echo "Waiting for database..."
|
||||
until pg_isready -h db -p 5432 -U ecommerce; do
|
||||
sleep 2
|
||||
|
||||
Reference in New Issue
Block a user