Skip to content

Commit f386bce

Browse files
committed
feat: setup Dockerfile and docker compose
1 parent c97c8c5 commit f386bce

3 files changed

Lines changed: 44 additions & 1 deletion

File tree

Dockerfile

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Stage 1: build
2+
FROM node:24-alpine AS builder
3+
WORKDIR /app
4+
ENV NODE_ENV=production
5+
6+
# Install dependencies (uses yarn if yarn.lock exists)
7+
COPY package.json yarn.lock ./
8+
RUN yarn install --frozen-lockfile
9+
10+
# Copy source and build
11+
COPY . .
12+
RUN yarn build
13+
14+
# Stage 2: serve with node
15+
FROM node:24-alpine
16+
17+
WORKDIR /app
18+
19+
ENV NODE_ENV=production
20+
# Uncomment the following line in case you want to disable telemetry during runtime.
21+
ENV NEXT_TELEMETRY_DISABLED=1
22+
23+
RUN addgroup --system --gid 1001 nodejs && adduser --system --uid 1001 nextjs
24+
25+
COPY --from=builder /app/public ./public
26+
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
27+
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
28+
29+
USER nextjs
30+
31+
EXPOSE 3000
32+
33+
ENV PORT=3000
34+
ENV HOSTNAME="0.0.0.0"
35+
CMD [ "node", "server.js" ]

docker-compose.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
services:
2+
web:
3+
build:
4+
context: .
5+
dockerfile: Dockerfile
6+
env_file: .env
7+
ports:
8+
- "3000:3000"

next.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/** @type {import('next').NextConfig} */
22
const nextConfig = {
33
reactStrictMode: true,
4-
swcMinify: true,
4+
output: "standalone",
55
};
66

77
module.exports = nextConfig;

0 commit comments

Comments
 (0)