2020-03-16 12:41:36 +01:00
|
|
|
# Stage 1 testing
|
2021-01-06 06:33:39 +00:00
|
|
|
FROM node:15.5.1-alpine as builder
|
2018-12-05 12:04:39 +01:00
|
|
|
|
2020-04-21 13:28:57 +02:00
|
|
|
COPY . /data
|
2018-12-05 12:04:39 +01:00
|
|
|
|
2020-04-21 13:28:57 +02:00
|
|
|
# build
|
|
|
|
RUN cd /data &&\
|
|
|
|
npm ci &&\
|
|
|
|
npm test &&\
|
|
|
|
npm run jshint_backend &&\
|
|
|
|
npm run jshint_frontend &&\
|
|
|
|
npm run bundle
|
2018-12-05 12:04:39 +01:00
|
|
|
|
2020-03-16 12:41:36 +01:00
|
|
|
# Stage 2 package
|
2021-01-06 06:33:39 +00:00
|
|
|
FROM node:15.5.1-alpine
|
2020-03-16 12:41:36 +01:00
|
|
|
|
2020-04-21 13:28:57 +02:00
|
|
|
COPY . /data
|
|
|
|
RUN apk update && apk add curl
|
2020-03-16 12:41:36 +01:00
|
|
|
|
2020-04-21 13:28:57 +02:00
|
|
|
RUN cd /data && npm ci --only=production
|
|
|
|
COPY --from=builder /data/public /data/public
|
2020-03-16 12:41:36 +01:00
|
|
|
|
2018-12-05 12:04:39 +01:00
|
|
|
WORKDIR /data
|
|
|
|
|
|
|
|
EXPOSE 8080
|
|
|
|
|
2020-04-21 13:28:57 +02:00
|
|
|
HEALTHCHECK --interval=5s --timeout=3s \
|
|
|
|
CMD curl -f http://localhost:8080/ || exit 1
|
|
|
|
|
2020-03-26 10:23:05 +01:00
|
|
|
CMD ["npm", "start"]
|