You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
42 lines
884 B
42 lines
884 B
## 1. Builder
|
|
# Use nodejs 10
|
|
FROM node:10-alpine AS builder
|
|
|
|
# Load repository into container
|
|
WORKDIR /rpdata-frontend
|
|
COPY . .
|
|
|
|
# Setup development environment
|
|
RUN apk add --no-cache git
|
|
|
|
# Erease all traces of browser-refresh
|
|
RUN sed -i '/browser-refresh/d' ./marko/page/layout.marko
|
|
RUN sed -i '/browser-refresh/d' ./package.json
|
|
|
|
# Install and compress node_modules
|
|
RUN rm -rf node_modules
|
|
RUN mkdir node_modules
|
|
RUN npm install -g modclean
|
|
RUN npm install
|
|
RUN npm dedupe
|
|
RUN modclean -r
|
|
|
|
# Remove dev stuff
|
|
RUN rm -rf .static
|
|
RUN rm -rf .cache
|
|
RUN rm -rf .git
|
|
|
|
# Build templates (when that works)
|
|
# RUN node build.js
|
|
|
|
## 2. Regroup
|
|
FROM node:10-alpine
|
|
RUN apk add --no-cache ca-certificates
|
|
|
|
# Bring data over from builder
|
|
WORKDIR /rpdata-frontend
|
|
COPY --from=builder /rpdata-frontend /rpdata-frontend
|
|
ENV NODE_ENV=production
|
|
|
|
# Entry point
|
|
CMD ["/usr/local/bin/node", "server"]
|