# build stage
FROM node:16-alpine3.12 as build
WORKDIR /app
COPY . .
RUN npm ci
RUN node bin/build-components
RUN node node_modules/.bin/eleventy build

# nginx server with url rewrites
FROM nginx:1.20.2-alpine
COPY --from=build /app/_site/ /usr/share/nginx/html
COPY ./nginx.conf /etc/nginx/conf.d/default.conf
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]
