ugh
This commit is contained in:
12
Dockerfile
12
Dockerfile
@@ -1,18 +1,13 @@
|
||||
# Use official Node.js image as base
|
||||
FROM node:18-alpine AS builder
|
||||
WORKDIR /app
|
||||
|
||||
# Install dependencies
|
||||
COPY package.json package-lock.json ./
|
||||
|
||||
RUN npm install --force
|
||||
|
||||
# Copy source code
|
||||
COPY . .
|
||||
|
||||
# Set environment variables for build
|
||||
ENV NODE_ENV=production
|
||||
ENV NEXT_PUBLIC_API_URL=/api
|
||||
ENV SERVER_API_URL=https://internal-api.inboxi.ng/api
|
||||
|
||||
# Build the Next.js application
|
||||
RUN npm run build
|
||||
@@ -23,22 +18,19 @@ FROM node:18-alpine AS runner
|
||||
# Set working directory inside the container
|
||||
WORKDIR /app
|
||||
|
||||
# Create necessary directories
|
||||
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
|
||||
COPY --from=builder /app/public ./public
|
||||
|
||||
# Expose the app port
|
||||
EXPOSE 3000
|
||||
|
||||
# Set runtime environment variables
|
||||
ENV NODE_ENV=production
|
||||
ENV NEXT_PUBLIC_API_URL=/api
|
||||
ENV SERVER_API_URL=https://internal-api.inboxi.ng/api
|
||||
|
||||
|
||||
# Start Next.js server
|
||||
CMD ["npm", "run", "start"]
|
||||
Reference in New Issue
Block a user