add entrypoint for db migration push
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -17,6 +17,7 @@ Thumbs.db
|
|||||||
.env.*
|
.env.*
|
||||||
!.env.example
|
!.env.example
|
||||||
!.env.test
|
!.env.test
|
||||||
|
pgdata
|
||||||
|
|
||||||
# Vite
|
# Vite
|
||||||
vite.config.js.timestamp-*
|
vite.config.js.timestamp-*
|
||||||
|
|||||||
11
Dockerfile
11
Dockerfile
@@ -35,8 +35,15 @@ RUN pnpm install --frozen-lockfile --prod
|
|||||||
# Copy built application from builder
|
# Copy built application from builder
|
||||||
COPY --from=builder /app/build ./build
|
COPY --from=builder /app/build ./build
|
||||||
|
|
||||||
|
# Install netcat for health checks
|
||||||
|
RUN apk add --no-cache netcat-openbsd
|
||||||
|
|
||||||
|
# Copy entrypoint script
|
||||||
|
COPY entrypoint.sh /app/entrypoint.sh
|
||||||
|
RUN chmod +x /app/entrypoint.sh
|
||||||
|
|
||||||
# Expose port (SvelteKit Node adapter default)
|
# Expose port (SvelteKit Node adapter default)
|
||||||
EXPOSE 5173
|
EXPOSE 3000
|
||||||
|
|
||||||
# Start the application
|
# Start the application
|
||||||
CMD ["node", "build"]
|
ENTRYPOINT ["/app/entrypoint.sh"]
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ services:
|
|||||||
POSTGRES_PASSWORD: mysecretpassword
|
POSTGRES_PASSWORD: mysecretpassword
|
||||||
POSTGRES_DB: memento
|
POSTGRES_DB: memento
|
||||||
volumes:
|
volumes:
|
||||||
|
# - ~/tmp/pgdata:/var/lib/postgresql
|
||||||
- ./pgdata:/var/lib/postgresql
|
- ./pgdata:/var/lib/postgresql
|
||||||
|
|
||||||
app:
|
app:
|
||||||
|
|||||||
14
entrypoint.sh
Normal file
14
entrypoint.sh
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# Wait for PostgreSQL to be ready
|
||||||
|
while ! nc -z db 5432; do
|
||||||
|
sleep 1
|
||||||
|
done
|
||||||
|
|
||||||
|
# Run database migrations
|
||||||
|
echo "Pushing database schema..."
|
||||||
|
pnpm run db:push
|
||||||
|
|
||||||
|
# Start the application
|
||||||
|
echo "Starting application..."
|
||||||
|
node build
|
||||||
Reference in New Issue
Block a user