-
Notifications
You must be signed in to change notification settings - Fork 35
/
Dockerfile
74 lines (51 loc) · 1.66 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# ? -------------------------
# ? Base: Including OS Lib Dependencies and environment variable for build
# ? -------------------------
FROM node:20-alpine AS base
ENV DOCKER_BUILD 1
ENV NEXT_PUBLIC_REALTIME_URL https://rtss.crackncode.org
ENV NEXT_PUBLIC_AWS_URL https://prginth01.sgp1.cdn.digitaloceanspaces.com
ENV GITHUB_ID mockvalue
ENV GITHUB_SECRET mockvalue
ENV GOOGLE_CLIENT_ID mockvalue
ENV GOOGLE_CLIENT_SECRET mockvalue
ENV BUCKET_NAME mockvalue
ENV BUCKET_KEY_ID mockvalue
ENV BUCKET_KEY_SECRET mockvalue
ENV BUCKET_ENDPOINT mockvalue
ENV BUCKET_REGION mockvalue
# ? -------------------------
# ? Builder: Build production Next.js application to .next
# ? -------------------------
FROM base AS builder
RUN apk add python3 make gcc g++
WORKDIR /app
RUN corepack enable
COPY package.json pnpm-lock.yaml* ./
RUN pnpm install --frozen-lockfile
COPY src ./src
COPY public ./public
COPY next.config.mjs postcss.config.js tailwind.config.js tsconfig.json ./
COPY prisma ./prisma
RUN pnpm prisma generate
ARG DATABASE_URL
ENV DATABASE_URL ${DATABASE_URL}
RUN pnpm build
# ? -------------------------
# ? Runner: Final Image for Production
# ? -------------------------
FROM base AS runner
WORKDIR /app
LABEL name "programming.in.th"
USER node
ENV NODE_ENV production
COPY package.json ./
# Automatically leverage output traces to reduce image size
# https://nextjs.org/docs/advanced-features/output-file-tracing
COPY --chown=node:node --from=builder /app/.next/standalone ./
COPY --chown=node:node --from=builder /app/.next/static ./.next/static
COPY --chown=node:node --from=builder /app/public ./public
ENV PORT 3000
ENV HOST 0.0.0.0
EXPOSE 3000
CMD ["node", "server.js"]