mirror of
https://github.com/amineo/t2-stat-parser.git
synced 2026-04-27 22:45:22 +00:00
Setup stats API container:
This commit is contained in:
parent
9176889086
commit
b3925a8fc6
10 changed files with 13775 additions and 55 deletions
70
build/api/Dockerfile
Normal file
70
build/api/Dockerfile
Normal file
|
|
@ -0,0 +1,70 @@
|
|||
# [ Stage 1 ] - install node modules
|
||||
FROM node:12.18-alpine as builder
|
||||
|
||||
WORKDIR /build/app
|
||||
|
||||
RUN npm i -g @nestjs/cli
|
||||
|
||||
COPY ./app/api .
|
||||
RUN npm install
|
||||
|
||||
ENV NODE_ENV=production
|
||||
RUN nest build
|
||||
|
||||
|
||||
# ============================
|
||||
# ============================
|
||||
|
||||
# [ Stage 2 ]
|
||||
FROM node:12.18-alpine
|
||||
LABEL maintainer="Season 4 <webmaster@season4.io>"
|
||||
|
||||
RUN apk update && apk add --no-cache openssl bash curl
|
||||
|
||||
# Default envs as prod
|
||||
ENV HOST=0.0.0.0 \
|
||||
PORT=8080 \
|
||||
NODE_ENV=production \
|
||||
APP_NAME=NestJS
|
||||
|
||||
ENV APP_URL=https://${HOST}:${PORT}
|
||||
|
||||
|
||||
# Setup pm2 as our node process manager
|
||||
# https://pm2.keymetrics.io/docs/usage/docker-pm2-nodejs/
|
||||
RUN npm i -g pm2 @nestjs/cli
|
||||
|
||||
RUN mkdir /opt/node_app && chown node:node /opt/node_app && mkdir /localcert && chown node:node /localcert
|
||||
RUN mkdir -p /opt/node_app/app/node_modules/ && chown node:node /opt/node_app/app/node_modules/
|
||||
|
||||
WORKDIR /opt/node_app
|
||||
|
||||
#USER node
|
||||
|
||||
# Generate a localhost cert
|
||||
# RUN openssl req -newkey rsa:2048 -new -nodes -x509 -days 3650 -keyout /localcert/key.pem -out /localcert/cert.pem -subj "/C=US/ST=New Jersey/L=Warren/O=localhost/OU=IT/CN=127.0.0.1"
|
||||
|
||||
|
||||
ENV PATH /opt/node_app/node_modules/.bin:$PATH
|
||||
|
||||
# Our App
|
||||
WORKDIR /opt/node_app/app
|
||||
|
||||
# Set node modules outside our app to keep it clean
|
||||
COPY --from=builder /build/app/node_modules/ /opt/node_app/node_modules/
|
||||
|
||||
COPY --from=builder /build/app/dist/ /opt/node_app/app/dist/
|
||||
|
||||
COPY ./app/api/package.json ./app/api/package-lock.json* ./
|
||||
|
||||
|
||||
# Start script and config
|
||||
COPY ./build/api/ecosystem._PROD_.config.js /opt/node_app/ecosystem._PROD_.config.js
|
||||
COPY ./build/api/entrypoint.sh /entrypoint.sh
|
||||
|
||||
EXPOSE 8080
|
||||
|
||||
HEALTHCHECK --interval=20s --timeout=30s --start-period=5s --retries=5 \
|
||||
CMD curl -f -k https://localhost:8443/healthz || exit 1
|
||||
|
||||
ENTRYPOINT [ "/entrypoint.sh" ]
|
||||
Loading…
Add table
Add a link
Reference in a new issue