[筆記] Dockerfile for 建置靜態網站與使用 nginx 來跑

每次都要想 Dockerfile 怎麼寫,乾脆筆記起來. build static website & run with nginx

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
FROM node:lts-alpine as builder

ENV NPM_CONFIG_LOGLEVEL=warn
ENV NPM_CONFIG_COLOR=false

WORKDIR /app
COPY . /app

RUN npm install

RUN npm run build

## production environment
FROM nginx:stable-alpine as deploy
COPY --from=builder /app/build /usr/share/nginx/html