try to depoly
This commit is contained in:
		
							
								
								
									
										31
									
								
								Dockerfile
									
									
									
									
									
								
							
							
						
						
									
										31
									
								
								Dockerfile
									
									
									
									
									
								
							@@ -1,34 +1,17 @@
 | 
				
			|||||||
FROM node:18-alpine AS build
 | 
					FROM node:18-alpine
 | 
				
			||||||
 | 
					
 | 
				
			||||||
WORKDIR /app
 | 
					WORKDIR /app
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Copy package files first for better layer caching
 | 
					COPY package.json .
 | 
				
			||||||
COPY package.json package-lock.json* ./
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Install dependencies
 | 
					RUN npm install
 | 
				
			||||||
RUN npm ci
 | 
					
 | 
				
			||||||
 | 
					RUN npm i -g serve
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Copy the rest of the application
 | 
					 | 
				
			||||||
COPY . .
 | 
					COPY . .
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Build the application
 | 
					 | 
				
			||||||
RUN npm run build
 | 
					RUN npm run build
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Production stage
 | 
					EXPOSE 3000
 | 
				
			||||||
FROM node:18-alpine AS production
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
WORKDIR /app
 | 
					CMD [ "serve", "-s", "dist" ]
 | 
				
			||||||
 | 
					 | 
				
			||||||
# Copy only the built assets and necessary files from the build stage
 | 
					 | 
				
			||||||
COPY --from=build /app/dist ./dist
 | 
					 | 
				
			||||||
COPY --from=build /app/package.json ./
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# Expose the port Vite uses by default
 | 
					 | 
				
			||||||
EXPOSE 5173
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# Use a static file server for production builds
 | 
					 | 
				
			||||||
RUN npm install -g serve
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# Serve the built application
 | 
					 | 
				
			||||||
CMD ["serve", "-s", "dist", "-l", "5173"]
 | 
					 | 
				
			||||||
@@ -6,7 +6,7 @@ services:
 | 
				
			|||||||
    container_name: healthy-oil
 | 
					    container_name: healthy-oil
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ports:
 | 
					    ports:
 | 
				
			||||||
      - "5173:5173"
 | 
					      - "3005:3000"
 | 
				
			||||||
    volumes:
 | 
					    volumes:
 | 
				
			||||||
      - .:/app
 | 
					      - .:/app
 | 
				
			||||||
      - /app/node_modules
 | 
					      - /app/node_modules
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -3,5 +3,16 @@ import react from '@vitejs/plugin-react'
 | 
				
			|||||||
import tsconfigPaths from "vite-tsconfig-paths"
 | 
					import tsconfigPaths from "vite-tsconfig-paths"
 | 
				
			||||||
// https://vite.dev/config/
 | 
					// https://vite.dev/config/
 | 
				
			||||||
export default defineConfig({
 | 
					export default defineConfig({
 | 
				
			||||||
 | 
					  base: "/",
 | 
				
			||||||
  plugins: [react(), tsconfigPaths()],
 | 
					  plugins: [react(), tsconfigPaths()],
 | 
				
			||||||
 | 
					  preview: {
 | 
				
			||||||
 | 
					    port: 8080,
 | 
				
			||||||
 | 
					    strictPort: true,
 | 
				
			||||||
 | 
					  },
 | 
				
			||||||
 | 
					  server: {
 | 
				
			||||||
 | 
					    port: 8080,
 | 
				
			||||||
 | 
					    strictPort: true,
 | 
				
			||||||
 | 
					    host: true,
 | 
				
			||||||
 | 
					    origin: "http://0.0.0.0:8080",
 | 
				
			||||||
 | 
					  },
 | 
				
			||||||
})
 | 
					})
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user