auto config import

This commit is contained in:
2025-06-22 03:22:50 +02:00
parent 9b078254ac
commit 459873f0e5
3 changed files with 26 additions and 2 deletions

View File

@@ -53,6 +53,7 @@ services:
- ./client/tsconfig.json:/opt/app/tsconfig.json - ./client/tsconfig.json:/opt/app/tsconfig.json
depends_on: depends_on:
- strapi - strapi
- postgres
networks: networks:
- strapi-network - strapi-network

View File

@@ -1,5 +1,8 @@
FROM node:22-alpine FROM node:22-alpine
# Install netcat for port checking
RUN apk add --no-cache netcat-openbsd
# Set working directory # Set working directory
WORKDIR /opt/app WORKDIR /opt/app
@@ -15,8 +18,11 @@ COPY . .
# Build the application # Build the application
RUN npm run build RUN npm run build
# Make startup script executable
RUN chmod +x start.sh
# Expose port # Expose port
EXPOSE 1337 EXPOSE 1337
# Start the application # Start the application with the startup script
CMD ["npm", "start"] CMD ["./start.sh"]

17
server/start.sh Normal file
View File

@@ -0,0 +1,17 @@
#!/bin/sh
# Start Strapi in the background
npm start &
STRAPI_PID=$!
# Wait for Strapi to be ready (check if port 1337 is listening)
echo "Waiting for Strapi to be ready..."
while ! nc -z localhost 1337; do
sleep 2
done
echo "Strapi is ready! Running config-sync import..."
npm run cs import
# Wait for the Strapi process
wait $STRAPI_PID