36 lines
931 B
Docker
36 lines
931 B
Docker
# gitzone dockerfile_service
|
|
## STAGE 1 // BUILD
|
|
FROM registry.gitlab.com/hosttoday/ht-docker-node:npmci as node1
|
|
COPY ./ /app
|
|
WORKDIR /app
|
|
ARG NPMCI_TOKEN_NPM2
|
|
ENV NPMCI_TOKEN_NPM2 $NPMCI_TOKEN_NPM2
|
|
RUN npmci npm prepare
|
|
RUN rm -rf node_modules && npm install
|
|
RUN npm run build
|
|
|
|
# gitzone dockerfile_service
|
|
## STAGE 2 // install production
|
|
FROM registry.gitlab.com/hosttoday/ht-docker-node:npmci as node2
|
|
WORKDIR /app
|
|
COPY --from=node1 /app /app
|
|
ARG NPMCI_TOKEN_NPM2
|
|
ENV NPMCI_TOKEN_NPM2 $NPMCI_TOKEN_NPM2
|
|
RUN npmci npm prepare
|
|
RUN rm -r node_modules/ && npm install --production
|
|
|
|
### Healthchecks
|
|
RUN npm install -g @servezone/healthy
|
|
HEALTHCHECK --interval=30s --timeout=30s --start-period=30s --retries=3 CMD [ "healthy" ]
|
|
|
|
EXPOSE 80
|
|
|
|
# Add Tini
|
|
ENV TINI_VERSION v0.19.0
|
|
ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini /tini
|
|
RUN chmod +x /tini
|
|
ENTRYPOINT ["/tini", "--"]
|
|
|
|
# CMD
|
|
CMD ["npm", "start"]
|