forked from ghostty-org/website
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
43 lines (32 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
# ===================================
# =========== BUILD IMAGE ===========
# ===================================
FROM node:22-alpine AS BUILD_IMAGE
# Set the Current Working Directory inside the container
WORKDIR /app
# Copy package.json files
COPY package.json package-lock.json ./
# Download all dependencies. Dependencies will be cached
# if the package.json files are not changed
RUN npm i
# Copy the source from the current directory to
# the Working Directory inside the container
COPY . .
# Compile the website (production build)
RUN npm run build
# remove development dependencies
RUN npm prune --production
# ===================================
# ========== RUNTIME IMAGE ==========
# ===================================
FROM node:22-alpine
# Set the Current Working Directory inside the container
WORKDIR /app
# Adds Bash for env variable access (alpine does not ship w/ Bash)
RUN apk update && apk add bash
COPY --from=BUILD_IMAGE /app/.next ./.next
COPY --from=BUILD_IMAGE /app/public ./public
COPY --from=BUILD_IMAGE /app/node_modules ./node_modules
COPY --from=BUILD_IMAGE /app/package.json ./package.json
# Run it
CMD npm run start