Skip to content

Commit

Permalink
fix: dockerfile
Browse files Browse the repository at this point in the history
Signed-off-by: Animesh Pathak <kurosakiichigo.songoku@gmail.com>
  • Loading branch information
Sonichigo committed Dec 10, 2024
1 parent 970a316 commit 1b6ddb7
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 0 deletions.
33 changes: 33 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Stage 1: Build the application
FROM node:18 AS builder

# Set the working directory
WORKDIR /app

# Copy package.json and package-lock.json
COPY package.json package-lock.json* ./

# Install dependencies
RUN npm install --legacy-peer-deps
RUN npm ci
# Copy the rest of the application files
COPY . .

# Build the application
RUN npm run build

# Stage 2: Serve the application
FROM builder AS runner

# Set the working directory
WORKDIR /app
COPY --from=builder /app/public ./public
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static

# Expose the application port
EXPOSE 3100

# Start the application on port 3100
ENV PORT=3100
CMD ["npm", "run", "dev"]
14 changes: 14 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
version: '3.8'

services:
nextjs:
container_name: nextjs-app
build:
context: .
dockerfile: Dockerfile
ports:
- "3100:3100"
environment:
- PORT=3100
volumes:
- .:/app # Mount the current directory to /app in the container

0 comments on commit 1b6ddb7

Please sign in to comment.