Fix deployment issues: remove volume mounts, run nginx as root, add fallback vite build strategy
This commit is contained in:
18
Dockerfile
18
Dockerfile
@ -71,8 +71,11 @@ RUN printf 'export interface UpdateCollectionData {\n name?: string;\n descrip
|
||||
# Mock users API with complete interface
|
||||
RUN printf 'export interface UpdateUserData {\n username?: string;\n displayName?: string;\n bio?: string;\n}\nexport const usersApi = {\n getUser: async (id: string) => null,\n getUserById: async (id: string) => null,\n getAllUsers: async () => [],\n searchUsers: async (query: string) => [],\n createUser: async (data: any) => ({ id: "mock" }),\n updateUser: async (id: string, data: UpdateUserData) => ({ id }),\n updateUserPermissions: async (id: string, permissions: any) => ({ id })\n};' > src/lib/api/users.ts
|
||||
|
||||
# Create a custom package.json script that skips TypeScript
|
||||
RUN echo '{"name":"scriptshare","scripts":{"build-no-ts":"vite build --mode development"}}' > package-build.json
|
||||
|
||||
# Skip TypeScript checking and build with Vite only (frontend demo)
|
||||
RUN npx vite build --mode development
|
||||
RUN npx vite build --mode development --config vite.config.ts || echo "Direct vite failed, trying alternative..." && npm run build-no-ts
|
||||
|
||||
# Verify build output exists
|
||||
RUN ls -la /app/dist
|
||||
@ -92,14 +95,13 @@ COPY nginx.conf /etc/nginx/nginx.conf
|
||||
# Create nginx pid directory
|
||||
RUN mkdir -p /var/run/nginx
|
||||
|
||||
# Set proper permissions
|
||||
RUN chown -R nginx:nginx /usr/share/nginx/html
|
||||
RUN chown -R nginx:nginx /var/cache/nginx
|
||||
RUN chown -R nginx:nginx /var/log/nginx
|
||||
RUN chown -R nginx:nginx /var/run/nginx
|
||||
# Set proper permissions for nginx directories
|
||||
RUN chmod -R 755 /usr/share/nginx/html
|
||||
RUN mkdir -p /var/cache/nginx /var/log/nginx /var/run/nginx
|
||||
RUN chmod -R 755 /var/cache/nginx /var/log/nginx /var/run/nginx
|
||||
|
||||
# Switch to non-root user for security
|
||||
USER nginx
|
||||
# Run as root for demo purposes (avoid permission issues)
|
||||
# USER nginx
|
||||
|
||||
# Expose port 80
|
||||
EXPOSE 80
|
||||
|
Reference in New Issue
Block a user