-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Animesh Pathak <kurosakiichigo.songoku@gmail.com>
- Loading branch information
Showing
2 changed files
with
47 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |