Skip to content

Commit c64f362

Browse files
authored
feat: support Dockerfile (#188)
1 parent e3abf27 commit c64f362

2 files changed

Lines changed: 33 additions & 0 deletions

File tree

.dockerignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
/node_modules
2+
/.github
3+
/.git
4+
/build

Dockerfile

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Install dependencies only when needed
2+
FROM node:16-alpine AS deps
3+
# Check https://github.com/nodejs/docker-node/tree/b4117f9333da4138b03a546ec926ef50a31506c3#nodealpine to understand why libc6-compat might be needed.
4+
RUN apk add --no-cache libc6-compat
5+
WORKDIR /app
6+
7+
COPY package.json yarn.lock ./
8+
9+
RUN yarn install
10+
11+
# Rebuild the source code only when needed
12+
FROM node:16-alpine AS builder
13+
WORKDIR /app
14+
15+
COPY --from=deps /app/node_modules ./node_modules
16+
COPY . .
17+
18+
RUN yarn build
19+
20+
# Production image, copy all the files and run next
21+
FROM nginx:1.20-alpine AS runner
22+
WORKDIR /app
23+
24+
COPY --from=builder /app/build /usr/share/nginx/html
25+
26+
EXPOSE 80
27+
ENV PORT 80
28+
29+
CMD ["nginx", "-g", "daemon off;"]

0 commit comments

Comments
 (0)