generated from frutbits/template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
45 lines (31 loc) · 1.13 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
FROM ghcr.io/hazmi35/node:18-dev-alpine as build-stage
LABEL name "nextjs-tailwind-boilerplate (build-stage)"
LABEL maintainer "FrutBits Indonesia <[email protected]>"
# Prepare pnpm with corepack (experimental feature)
RUN corepack enable && corepack prepare pnpm@latest
# Copy package.json, lockfile and npm config files
COPY package.json pnpm-lock.yaml ./
# Fetch dependencies to virtual store
RUN pnpm fetch
# Install dependencies
RUN pnpm install --offline --frozen-lockfile
# Copy Project files
COPY . .
# Build Next.js Project
RUN pnpm run build
# Prune devDependencies
RUN pnpm prune --production
# Get ready for production
FROM ghcr.io/hazmi35/node:18-alpine
LABEL name "nextjs-tailwind-boilerplate"
LABEL maintainer "FrutBits Indonesia <[email protected]>"
# Copy needed files
COPY --from=build-stage /tmp/build/package.json .
COPY --from=build-stage /tmp/build/public ./public
COPY --from=build-stage /tmp/build/.next/ ./.next
COPY --from=build-stage /tmp/build/node_modules ./node_modules
# Additional Environment Variables
ENV NODE_ENV production
EXPOSE 80
# Start the app with node
CMD ["npm", "run", "start", "--", "-p", "80"]