container-scan-work

This commit is contained in:
David Adewole 2021-07-09 14:00:50 +01:00
parent 5661113fea
commit e02e54d5d7
6 changed files with 87 additions and 1679 deletions

27
container-scanner/Dockerfile Executable file
View File

@ -0,0 +1,27 @@
#
# Fyipe-backend Dockerfile
#
# Pull base image nodejs image.
FROM node:16
#SET ENV Variables
ENV PRODUCTION=true
RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app
# Install app dependencies
COPY package*.json /usr/src/app/
RUN npm ci --only=production
# Bundle app source
COPY . /usr/src/app
# Expose ports.
# - 3055: Container Scanner
EXPOSE 3055
#Run the app
CMD [ "npm", "start"]

View File

@ -0,0 +1,26 @@
#
# Fyipe-backend Dockerfile
#
# Pull base image nodejs image.
FROM node:16
WORKDIR /usr/src/app
# Install app dependencies
RUN cd /usr/src/app
# Copy package.json files
COPY ./package.json /usr/src/app/package.json
COPY ./package-lock.json /usr/src/app/package-lock.json
RUN npm ci
# Expose ports.
# - 3055: Container Scanner
EXPOSE 3055
#Run the app
CMD [ "npm", "run", "dev"]

View File

@ -5,7 +5,8 @@
"main": "index.js",
"scripts": {
"start": "node --max-old-space-size=4096 --max-http-header-size=80000 index.js",
"test": "echo \"Error: no test specified\" && exit 1"
"test": "echo \"Error: no test specified\" && exit 1",
"dev": "node --max-old-space-size=4096 --max-http-header-size=80000 index.js"
},
"author": "David Adewole",
"license": "MIT",

View File

@ -285,6 +285,26 @@ services:
# Use node modules of the container and not host system.
# https://stackoverflow.com/questions/29181032/add-a-volume-to-docker-but-exclude-a-sub-folder
- /usr/src/app/node_modules/
container-scanner:
ports:
- '3055:3055'
- '9242:9229' # Debugging port.
build:
context: ./container-scanner
dockerfile: ./Dockerfile.dev
env_file:
- ./container-scanner/.env
environment:
- PORT=3055
- SERVER_URL=http://backend:3002
- CONTAINER_SCANNER_NAME=US
- CONTAINER_SCANNER_KEY=test-key
- IS_SAAS_SERVICE=${IS_SAAS_SERVICE}
volumes:
- ./container-scanner:/usr/src/app
# Use node modules of the container and not host system.
# https://stackoverflow.com/questions/29181032/add-a-volume-to-docker-but-exclude-a-sub-folder
- /usr/src/app/node_modules/
lighthouse-runner:
ports:
- '3015:3015'

View File

@ -195,6 +195,18 @@ services:
- IS_SAAS_SERVICE=${IS_SAAS_SERVICE}
depends_on:
- backend
container-scanner:
ports:
- '3055:3055'
build: ./container-scanner
env_file:
- ./container-scanner/.env
environment:
- PORT=3055
- SERVER_URL=http://backend:3002
- IS_SAAS_SERVICE=${IS_SAAS_SERVICE}
depends_on:
- backend
lighthouse-runner:
ports:
- '3015:3015'