Listory/Dockerfile

50 lines
893 B
Text
Raw Normal View History

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/
RUN npm run build
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
COPY frontend/src/ /app/frontend/src/
COPY frontend/public/ /app/frontend/public/
RUN 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"]