Compare commits
2 Commits
5e3c6367c2
...
d3adfa5cb2
Author | SHA1 | Date |
---|---|---|
|
d3adfa5cb2 | |
|
48c8f46781 |
47
Dockerfile
47
Dockerfile
|
@ -1,25 +1,36 @@
|
||||||
|
FROM node:18-alpine AS build
|
||||||
FROM node:18-alpine
|
|
||||||
|
|
||||||
RUN mkdir -p /app
|
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
COPY package.json ./
|
# Copy package files first for better layer caching
|
||||||
|
COPY package.json package-lock.json* ./
|
||||||
|
|
||||||
RUN npm install
|
# Install dependencies
|
||||||
|
RUN npm ci
|
||||||
RUN npm install --save-dev
|
|
||||||
|
|
||||||
|
|
||||||
COPY . /app
|
|
||||||
|
|
||||||
# Build the Next.js app
|
|
||||||
RUN npm run build
|
|
||||||
|
|
||||||
# Expose the port the app will run on
|
|
||||||
EXPOSE 3000
|
|
||||||
|
|
||||||
|
# Copy the rest of the application
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
CMD ["npm", "run", "dev"]
|
# Build the application
|
||||||
|
RUN npm run build
|
||||||
|
|
||||||
|
# Production stage
|
||||||
|
FROM node:18-alpine AS production
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
# Copy only the built assets and necessary files from the build stage
|
||||||
|
COPY --from=build /app/dist ./dist
|
||||||
|
COPY --from=build /app/package.json ./
|
||||||
|
|
||||||
|
# Install only production dependencies
|
||||||
|
RUN npm ci --omit=dev
|
||||||
|
|
||||||
|
# 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:
|
||||||
- "3005:3000"
|
- "3005:5173"
|
||||||
volumes:
|
volumes:
|
||||||
- .:/app
|
- .:/app
|
||||||
- /app/node_modules
|
- /app/node_modules
|
||||||
|
|
Loading…
Reference in New Issue