Bitmagnet-Next-Web/Dockerfile

40 lines
923 B
Docker
Raw Normal View History

# Use node:18-alpine as the base image
FROM node:18-alpine AS base
# Set the working directory
WORKDIR /app
# Install dependencies
FROM base AS deps
COPY package.json ./
2024-06-19 08:24:25 +00:00
RUN npm config set registry 'https://registry.npmmirror.com/'
RUN npm install
# Build the application
FROM base AS builder
COPY --from=deps /app/node_modules ./node_modules
COPY . .
RUN npm run build
# Prepare the runner stage
FROM node:18-alpine AS runner
# Set the working directory
WORKDIR /app
# Copy the necessary files from the builder stage
COPY --from=builder /app/package.json ./package.json
2024-06-19 08:24:25 +00:00
COPY --from=builder /app/public ./public
COPY --from=builder /app/.next/standalone ./
COPY --from=builder /app/.next/static ./.next/static
COPY --from=builder /app/.next/server ./.next/server
# Expose the application port
EXPOSE 3000
2024-06-21 15:51:45 +00:00
# Set environment variables
ENV HOSTNAME=0.0.0.0 PORT=3000
# Start the application
2024-06-19 08:24:25 +00:00
CMD ["node", "server.js"]