Skip to content

Instantly share code, notes, and snippets.

@gp187
Last active April 16, 2020 15:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gp187/975b1ad912d3825b2295712af1b01a8b to your computer and use it in GitHub Desktop.
Save gp187/975b1ad912d3825b2295712af1b01a8b to your computer and use it in GitHub Desktop.
pipeline.yaml
FROM node:12.15.0
LABEL maintainer="Naologic <contact@naologic.com>"
# Make the dir
RUN mkdir -p /var/nao
RUN mkdir -p /etc/pm2-web
WORKDIR /var/nao
# Bundle APP files
COPY dist dist/
COPY pm2-web.config.json /etc/pm2-web/config.json
COPY ["tslint.json", "tsconfig.json", "./"]
COPY ["tsconfig.build.json", "nest-cli.json", "package.json", "./"]
COPY ["app.pm2.json", "micro-services.pm2.json", "./"]
#COPY [".env", ".env_staging", ".env_production", "./"]
# Install app dependencies
ENV NPM_CONFIG_LOGLEVEL warn
RUN npm install -g pm2
RUN npm install -g @nestjs/cli
#RUN npm install -g ts-node
#RUN npm install -g ts-node
# Skip and use node_modules from storage
RUN npm install
#RUN npm audit fix
# Install plugins
#RUN pm2 install pm2-server-monit
#RUN pm2 install pm2-auto-pull
# Show current folder structure in logs
RUN ls -l
# Expose API ports (3000:3010) and Websocket ports (31200:31225)
#EXPOSE 3000:3010 31200:31225
EXPOSE 3001
EXPOSE 80
CMD [ "pm2-runtime", "start", "app.pm2.json", "--env", "production", "--watch" ]
#CMD [ "nest", "start", "--watch" ]
kind: Service
apiVersion: v1
metadata:
name: nesty-service
spec:
selector:
app: nesty
ports:
- protocol: TCP
port: 80
name: api
targetPort: 3001
type: NodePort
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: nesty
labels:
app: nesty
spec:
replicas: 1
revisionHistoryLimit: 10
selector:
matchLabels:
app: nesty
template:
metadata:
labels:
app: nesty
spec:
imagePullSecrets:
- name: pipeline-docker-registry
containers:
- name: nesty
image: ${CICD_IMAGE}:${CICD_EXECUTION_SEQUENCE}
ports:
- containerPort: 3001
imagePullPolicy: Always
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment