forked from Karhdo/karhdo.dev
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
42 lines (33 loc) · 1.04 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
# Build BASE
FROM node:18-alpine as BASE
LABEL author="karhdo <[email protected]>"
WORKDIR /app
COPY package.json yarn.lock ./
RUN apk add --no-cache git \
&& yarn install --frozen-lockfile \
&& yarn cache clean
# Build Image
FROM karhdo/node:18-alpine AS BUILD
LABEL author="karhdo <[email protected]>"
WORKDIR /app
COPY --from=BASE /app/node_modules ./node_modules
COPY . .
RUN npx prisma generate
RUN apk add --no-cache git curl \
&& yarn add sharp \
&& yarn build \
&& rm -rf node_modules \
&& yarn install --production --frozen-lockfile --ignore-scripts --prefer-offline \
&& node-prune
# Build production
FROM node:18-alpine AS PRODUCTION
LABEL author="karhdo <[email protected]>"
WORKDIR /app
COPY --from=BUILD /app/public ./public
COPY --from=BUILD /app/next.config.js ./
# Set mode "standalone" in file "next.config.js"
COPY --from=BUILD /app/.next/standalone ./
COPY --from=BUILD /app/.next/static ./.next/static
COPY --from=BUILD /app/.next/server ./.next/server
EXPOSE 3000
CMD ["node", "server.js"]