Files
ember-market-frontend/Dockerfile
2025-03-10 17:39:37 +00:00

35 lines
698 B
Docker

# Use official Node.js image as base
FROM node:18-alpine AS builder
WORKDIR /app
COPY package.json package-lock.json ./
RUN npm install --force
COPY . .
ENV NEXT_PUBLIC_API_URL=/api
# Build the Next.js application
RUN npm run build
# ---- Production Stage ----
FROM node:18-alpine AS runner
# Set working directory inside the container
WORKDIR /app
RUN mkdir -p /app/public
# Copy only necessary files from builder
COPY --from=builder /app/package.json /app/package-lock.json ./
COPY --from=builder /app/.next ./.next
COPY --from=builder /app/node_modules ./node_modules
EXPOSE 3000
ENV NODE_ENV=production
ENV NEXT_PUBLIC_API_URL=/api
# Start Next.js server
CMD ["npm", "run", "start"]