2020-01-26 19:07:15 +01:00
|
|
|
##################
|
|
|
|
|
## common
|
|
|
|
|
##################
|
2020-01-25 22:19:14 +01:00
|
|
|
FROM node:12-alpine as common
|
|
|
|
|
LABEL org.label-schema.schema-version="1.0" \
|
|
|
|
|
org.label-schema.name="listory" \
|
|
|
|
|
stage="common"
|
2020-01-26 19:07:15 +01:00
|
|
|
|
2020-01-25 22:19:14 +01:00
|
|
|
WORKDIR /app
|
2020-01-26 19:07:15 +01:00
|
|
|
|
2020-01-25 22:19:14 +01:00
|
|
|
COPY *.json /app/
|
2020-01-26 19:07:15 +01:00
|
|
|
COPY frontend/*.json /app/frontend/
|
2020-01-25 22:19:14 +01:00
|
|
|
|
2020-01-26 19:07:15 +01:00
|
|
|
##################
|
|
|
|
|
## build-api
|
|
|
|
|
##################
|
|
|
|
|
FROM common as build-api
|
|
|
|
|
LABEL stage="build-api"
|
2020-01-25 22:19:14 +01:00
|
|
|
|
|
|
|
|
RUN npm ci
|
|
|
|
|
|
|
|
|
|
COPY src/ /app/src/
|
2020-05-02 03:03:19 +02:00
|
|
|
RUN NODE_ENV=production npm run build
|
2020-01-25 22:19:14 +01:00
|
|
|
|
2020-01-26 19:07:15 +01:00
|
|
|
##################
|
|
|
|
|
## build-frontend
|
|
|
|
|
##################
|
|
|
|
|
FROM common as build-frontend
|
|
|
|
|
LABEL stage="build-frontend"
|
|
|
|
|
|
|
|
|
|
WORKDIR /app/frontend
|
|
|
|
|
|
|
|
|
|
RUN npm ci
|
|
|
|
|
|
2020-05-02 03:03:19 +02:00
|
|
|
COPY frontend/postcss.config.js /app/frontend/postcss.config.js
|
2020-01-26 19:07:15 +01:00
|
|
|
COPY frontend/src/ /app/frontend/src/
|
|
|
|
|
COPY frontend/public/ /app/frontend/public/
|
2020-05-02 03:03:19 +02:00
|
|
|
RUN NODE_ENV=production npm run build
|
2020-01-25 22:19:14 +01:00
|
|
|
|
2020-01-26 19:07:15 +01:00
|
|
|
##################
|
|
|
|
|
## app
|
|
|
|
|
##################
|
2020-01-25 22:19:14 +01:00
|
|
|
FROM common as app
|
|
|
|
|
LABEL stage="app"
|
|
|
|
|
|
|
|
|
|
RUN npm ci --only=production
|
2020-01-26 19:07:15 +01:00
|
|
|
COPY --from=build-api /app/dist/ /app/dist/
|
|
|
|
|
COPY --from=build-frontend /app/frontend/dist /app/static/
|
2020-01-25 22:19:14 +01:00
|
|
|
|
|
|
|
|
CMD ["dist/main"]
|