24 lines
560 B
Docker
24 lines
560 B
Docker
FROM node:lts-alpine
|
|
|
|
# install simple http server for serving static content
|
|
RUN npm install -g http-server
|
|
|
|
# make the 'app' folder the current working directory
|
|
WORKDIR /app
|
|
|
|
# copy both 'package.json' and 'package-lock.json' (if available)
|
|
COPY package*.json ./
|
|
# build stage
|
|
FROM node:lts-alpine as build-stage
|
|
WORKDIR /app
|
|
COPY package*.json ./
|
|
RUN npm install
|
|
COPY . .
|
|
RUN npm run build
|
|
|
|
# production stage
|
|
FROM nginx:stable-alpine as production-stage
|
|
COPY --from=build-stage /app/dist /usr/share/nginx/html
|
|
EXPOSE 80
|
|
CMD ["nginx", "-g", "daemon off;"]
|