Skip to content

Commit 7d0893b

Browse files
committed
feat(docker): dockerize repo
1 parent cc798d5 commit 7d0893b

File tree

5 files changed

+67
-2
lines changed

5 files changed

+67
-2
lines changed

.dockerignore

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
node_modules/
2+
.vscode
3+
4+
eslint.config.mjs
5+
.gitignore
6+
.prettierrc
7+
.prettierignore
8+
commitlint.config.ts
9+
10+
.next
11+
.husky

Dockerfile

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
FROM node:20.15.1-alpine AS base
2+
3+
FROM base AS deps
4+
RUN apk add --no-cache libc6-compat python3 make g++ gcc
5+
WORKDIR /app
6+
7+
COPY prisma/ /app/prisma/
8+
COPY package.json pnpm-lock.yaml* ./
9+
RUN \
10+
corepack enable pnpm && pnpm i
11+
12+
FROM base AS builder
13+
WORKDIR /app
14+
COPY --from=deps /app/node_modules ./node_modules
15+
COPY . .
16+
17+
RUN \
18+
corepack enable pnpm && pnpm add sharp && pnpm run build
19+
20+
FROM base AS runner
21+
WORKDIR /app
22+
23+
ENV NODE_ENV=production
24+
ENV NODE_OPTIONS="--network-family-autoselection-attempt-timeout=500"
25+
26+
RUN addgroup --system --gid 1001 nodejs
27+
RUN adduser --system --uid 1001 nextjs
28+
29+
COPY --from=builder /app/public ./public
30+
31+
RUN mkdir .next
32+
RUN chown nextjs:nodejs .next
33+
34+
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
35+
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
36+
37+
USER nextjs
38+
39+
EXPOSE 3000
40+
41+
ENV PORT=3000 HOSTNAME=0.0.0.0
42+
43+
CMD ["node", "server.js"]

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@
77
- Theming (light, dark, system)
88
- Multi language (en, vi)
99
- Login with social media (google, github)
10-
-
10+
-

compose.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
services:
2+
starter-kit:
3+
container_name: starter-kit
4+
build:
5+
context: .
6+
dockerfile: Dockerfile
7+
ports:
8+
- 3000:3000
9+
restart: unless-stopped

next.config.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ import type { NextConfig } from "next";
33

44
const withNextIntl = createNextIntlPlugin("./i18n/request.ts");
55

6-
const nextConfig: NextConfig = {};
6+
const nextConfig: NextConfig = {
7+
output: "standalone"
8+
};
79

810
export default withNextIntl(nextConfig);

0 commit comments

Comments
 (0)