Update Dockerfile to enhance TypeScript configuration with JSX support, install wget for health checks, and improve healthcheck command compatibility.
This commit is contained in:
12
Dockerfile
12
Dockerfile
@ -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;"]
|
||||
|
Reference in New Issue
Block a user