Skip to content

Commit

Permalink
Merge branch 'support/cicd' into 'develop'
Browse files Browse the repository at this point in the history
Support/cicd

Closes #61

See merge request PBSA/dapps/NFT-store!3
  • Loading branch information
RoshanSyed committed May 26, 2021
2 parents 8268693 + dc585e2 commit cc80568
Show file tree
Hide file tree
Showing 4 changed files with 77 additions and 26 deletions.
49 changes: 49 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# gitlab scanning
include:
- template: Dependency-Scanning.gitlab-ci.yml
- template: License-Scanning.gitlab-ci.yml
- template: SAST.gitlab-ci.yml
- template: Secret-Detection.gitlab-ci.yml
- template: Container-Scanning.gitlab-ci.yml

variables:
GIT_DEPTH: "2" # Tells git to fetch all the branches of the project, required by the analysis task
DOCKER_DRIVER: overlay2

stages:
- build
- test
- deploy

# builds app
build:
# node docker image on which this would be run
image: node:14.16.1-alpine3.13
stage: build
script:
- npm install
tags:
- docker

docker_build:
image: docker:stable
stage: build
services:
- docker:19.03.12-dind
variables:
IMAGE: $CI_REGISTRY_IMAGE/$CI_COMMIT_REF_SLUG:$CI_COMMIT_SHA
script:
- docker info
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
- docker build -t $IMAGE .
- docker push $IMAGE

deployToDev:
stage: deploy
script:
- docker-compose down
- docker-compose up --build -d
when:
manual
tags:
- nftdev1
40 changes: 20 additions & 20 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
FROM mhart/alpine-node:8

ENV NODE_VERSION 8.9.4

RUN apk add --no-cache make gcc g++ python bash

WORKDIR /var/expressCart

COPY lib/ /var/expressCart/lib/
COPY bin/ /var/expressCart/bin/
COPY config/ /var/expressCart/config/
COPY public/ /var/expressCart/public/
COPY routes/ /var/expressCart/routes/
COPY views/ /var/expressCart/views/

COPY app.js /var/expressCart/
COPY package.json /var/expressCart/
COPY deploy.js /var/expressCart/

FROM node:14.16.1-alpine3.13

RUN apk update && apk add \
g++ \
make \
nasm \
git \
libtool \
autoconf \
automake \
libpng-dev \
pkgconfig

WORKDIR /var/nftstore

COPY package*.json /var/nftstore/
RUN npm install

VOLUME /var/expressCart/data
COPY ./ /var/nftstore/

VOLUME /var/nftstore/data

EXPOSE 1111

ENTRYPOINT ["npm", "start"]
4 changes: 2 additions & 2 deletions config/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"paymentGateway": [
"stripe"
],
"databaseConnectionString": "mongodb://127.0.0.1:27017/expresscart",
"databaseConnectionString": "mongodb://nft-store-mongodb:27017/expresscart",
"theme": "Cloth",
"trackStock": false,
"orderHook": "",
Expand Down Expand Up @@ -58,4 +58,4 @@
"peerplaysAccountID": "1.2.73",
"commission": 10,
"categories": ["Digital Art", "Photographs", "Oil Paintings"]
}
}
10 changes: 6 additions & 4 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
version: '3'
services:
nftstore:
image: "node:8"
image: "node:14.16.1-alpine3.13"
build: .
container_name: "nft-store"
volumes:
- nft-store-uploads-data:/uploads
environment:
NODE_ENV: development
NODE_PATH: /
Expand All @@ -14,12 +16,12 @@ services:
depends_on:
- mongodb
mongodb:
image: mongo:3.4.10
image: mongo:4.4
container_name: "nft-store-mongodb"
volumes:
- nft-store-mongo-data:/data/db
ports:
- 27017:27017
command: mongod --smallfiles --logpath=/dev/null
volumes:
nft-store-mongo-data:
nft-store-uploads-data:
nft-store-mongo-data:

0 comments on commit cc80568

Please sign in to comment.