Update Dockerfile to enhance TypeScript configuration with JSX support, install wget for health checks, and improve healthcheck command compatibility.
Some checks failed
Build and Test / test (push) Has been cancelled
Build and Test / docker-build (push) Has been cancelled

This commit is contained in:
2025-08-20 06:14:15 +01:00
parent d6dd571f5c
commit a15b87aa5d
2 changed files with 70 additions and 6 deletions

View File

@ -73,8 +73,8 @@ RUN printf 'export interface CreateUserData {\n email: string;\n username: str
# Create a custom package.json script that skips TypeScript
RUN echo '{"name":"scriptshare","scripts":{"build-no-ts":"vite build --mode development"}}' > package-build.json
# Create a very lenient tsconfig.json that allows everything and includes path mappings
RUN echo '{"compilerOptions":{"target":"ES2020","useDefineForClassFields":true,"lib":["ES2020","DOM","DOM.Iterable"],"module":"ESNext","skipLibCheck":true,"moduleResolution":"bundler","allowImportingTsExtensions":true,"resolveJsonModule":true,"isolatedModules":true,"noEmit":true,"strict":false,"noImplicitAny":false,"noImplicitReturns":false,"noFallthroughCasesInSwitch":false,"baseUrl":".","paths":{"@/*":["./src/*"]}},"include":["src"],"references":[{"path":"./tsconfig.node.json"}]}' > tsconfig.json
# Create a very lenient tsconfig.json that allows everything and includes path mappings and JSX
RUN echo '{"compilerOptions":{"target":"ES2020","useDefineForClassFields":true,"lib":["ES2020","DOM","DOM.Iterable"],"module":"ESNext","skipLibCheck":true,"moduleResolution":"bundler","allowImportingTsExtensions":true,"resolveJsonModule":true,"isolatedModules":true,"noEmit":true,"jsx":"react-jsx","strict":false,"noImplicitAny":false,"noImplicitReturns":false,"noFallthroughCasesInSwitch":false,"baseUrl":".","paths":{"@/*":["./src/*"]}},"include":["src"],"references":[{"path":"./tsconfig.node.json"}]}' > tsconfig.json
# Force build with very lenient settings - try multiple approaches
RUN npm run build || npx vite build --mode development || echo "Build failed, creating fallback static site..." && mkdir -p dist && echo "<!DOCTYPE html><html><head><title>ScriptShare Demo</title></head><body><h1>ScriptShare</h1><p>Demo deployment - build in progress</p></body></html>" > dist/index.html
@ -85,8 +85,8 @@ RUN ls -la /app/dist && echo "Build completed successfully!"
# Production stage
FROM nginx:alpine
# Install curl for health checks
RUN apk add --no-cache curl
# Install curl and wget for health checks (Coolify uses wget)
RUN apk add --no-cache curl wget
# Copy built files from builder stage
COPY --from=builder /app/dist /usr/share/nginx/html
@ -108,9 +108,9 @@ RUN chmod -R 755 /var/cache/nginx /var/log/nginx /var/run/nginx
# Expose port 80
EXPOSE 80
# Add healthcheck
# Add healthcheck (compatible with both curl and wget)
HEALTHCHECK --interval=30s --timeout=10s --start-period=40s --retries=3 \
CMD curl -f http://localhost/health || exit 1
CMD curl -f http://localhost/ || wget -q --spider http://localhost/ || exit 1
# Start nginx
CMD ["nginx", "-g", "daemon off;"]