Compare commits
12 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
bb7b15351d
|
|||
|
bc73ab271b
|
|||
|
b1b1f3e0b9
|
|||
|
30c86accf6
|
|||
|
0882e8754e
|
|||
|
73ac3d2dc6
|
|||
| 5500a5644d | |||
|
4f00ef6ae4
|
|||
|
6ef8c553ce
|
|||
|
f2dce58f5e
|
|||
|
9c4e47fb72
|
|||
|
b969adbc2e
|
43
.drone.yml
43
.drone.yml
@@ -7,9 +7,15 @@ workspace:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: yarn install
|
- name: yarn install
|
||||||
image: node:latest
|
image: node:20-bullseye-slim
|
||||||
|
environment:
|
||||||
|
YARN_VERSION: 3.5.0
|
||||||
commands:
|
commands:
|
||||||
|
- yarn set version stable
|
||||||
- yarn install
|
- yarn install
|
||||||
|
volumes:
|
||||||
|
- name: yarnrc
|
||||||
|
path: /drone/auth/.yarnrc.yml
|
||||||
- name: Code Style Checks
|
- name: Code Style Checks
|
||||||
image: node:latest
|
image: node:latest
|
||||||
commands:
|
commands:
|
||||||
@@ -40,7 +46,7 @@ steps:
|
|||||||
- name: Build
|
- name: Build
|
||||||
image: node:latest
|
image: node:latest
|
||||||
commands:
|
commands:
|
||||||
- yarn build
|
- yarn build:production
|
||||||
- name: Send Build Status Notifications
|
- name: Send Build Status Notifications
|
||||||
image: plugins/webhook
|
image: plugins/webhook
|
||||||
settings:
|
settings:
|
||||||
@@ -57,6 +63,11 @@ steps:
|
|||||||
- success
|
- success
|
||||||
- failure
|
- failure
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
- name: yarnrc
|
||||||
|
host:
|
||||||
|
path: /volume1/docker/.yarnrc.yml
|
||||||
|
|
||||||
trigger:
|
trigger:
|
||||||
branch:
|
branch:
|
||||||
- main
|
- main
|
||||||
@@ -74,18 +85,25 @@ workspace:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Build Package
|
- name: Build Package
|
||||||
image: node:latest
|
image: node:20-bullseye-slim
|
||||||
|
environment:
|
||||||
|
YARN_VERSION: 3.5.0
|
||||||
commands:
|
commands:
|
||||||
- yarn install
|
- yarn set version stable
|
||||||
- yarn build
|
- yarn install
|
||||||
|
- yarn build:production
|
||||||
|
volumes:
|
||||||
|
- name: yarnrc
|
||||||
|
path: /drone/auth/.yarnrc.yml
|
||||||
- name: Publish NPM
|
- name: Publish NPM
|
||||||
image: node:20-alpine
|
image: node:20-bullseye-slim
|
||||||
failure: ignore
|
|
||||||
commands:
|
commands:
|
||||||
- yarn publish -t ${DRONE_TAG}
|
- yarn npm publish
|
||||||
volumes:
|
volumes:
|
||||||
- name: npmrc
|
- name: npmrc
|
||||||
path: /drone/auth/.npmrc
|
path: /drone/auth/.npmrc
|
||||||
|
- name: yarnrc
|
||||||
|
path: /drone/auth/.yarnrc.yml
|
||||||
- name: Report NPM Publish Status
|
- name: Report NPM Publish Status
|
||||||
image: plugins/webhook
|
image: plugins/webhook
|
||||||
settings:
|
settings:
|
||||||
@@ -107,7 +125,11 @@ steps:
|
|||||||
auto_tag: true
|
auto_tag: true
|
||||||
repo: git.mifi.dev/mifi/auth-service
|
repo: git.mifi.dev/mifi/auth-service
|
||||||
registry: git.mifi.dev
|
registry: git.mifi.dev
|
||||||
debug: true
|
build_args:
|
||||||
|
- MONGO_ENTRY_FILE=latest
|
||||||
|
- MONGO_VERSION=latest
|
||||||
|
- NPM_TOKEN:
|
||||||
|
from_secret: reg_token
|
||||||
ssh-agent-key:
|
ssh-agent-key:
|
||||||
from_secret: reg_token
|
from_secret: reg_token
|
||||||
username: <token>
|
username: <token>
|
||||||
@@ -140,6 +162,9 @@ volumes:
|
|||||||
- name: npmrc
|
- name: npmrc
|
||||||
host:
|
host:
|
||||||
path: /volume1/docker/beethoven/labs-auth/.npmrc
|
path: /volume1/docker/beethoven/labs-auth/.npmrc
|
||||||
|
- name: yarnrc
|
||||||
|
host:
|
||||||
|
path: /volume1/docker/.yarnrc.yml
|
||||||
|
|
||||||
depends_on:
|
depends_on:
|
||||||
- Test Pipeline
|
- Test Pipeline
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ module.exports = {
|
|||||||
plugins: ['@typescript-eslint'],
|
plugins: ['@typescript-eslint'],
|
||||||
settings: {
|
settings: {
|
||||||
'import/parsers': {
|
'import/parsers': {
|
||||||
'@typescript-eslint/parser': [".ts", ".tsx"],
|
'@typescript-eslint/parser': ['.ts', '.tsx'],
|
||||||
},
|
},
|
||||||
'import/resolver': 'typescript',
|
'import/resolver': 'typescript',
|
||||||
},
|
},
|
||||||
|
|||||||
3
.gitignore
vendored
3
.gitignore
vendored
@@ -130,3 +130,6 @@ dist
|
|||||||
.yarn/install-state.gz
|
.yarn/install-state.gz
|
||||||
.pnp.*
|
.pnp.*
|
||||||
|
|
||||||
|
# Project
|
||||||
|
lib/
|
||||||
|
dist/
|
||||||
|
|||||||
12
.npmignore
Normal file
12
.npmignore
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
.build.yarnrc.yml
|
||||||
|
.drone.yml
|
||||||
|
.env*
|
||||||
|
.eslintrc*
|
||||||
|
.npmrc
|
||||||
|
.prettierrc*
|
||||||
|
.yarnrc.yml
|
||||||
|
babel.config.*
|
||||||
|
jest.config.*
|
||||||
|
src
|
||||||
|
tsconfig*.json
|
||||||
|
tslint.json
|
||||||
873
.yarn/releases/yarn-3.5.1.cjs
vendored
Executable file
873
.yarn/releases/yarn-3.5.1.cjs
vendored
Executable file
File diff suppressed because one or more lines are too long
@@ -1 +1,3 @@
|
|||||||
nodeLinker: node-modules
|
nodeLinker: node-modules
|
||||||
|
|
||||||
|
yarnPath: .yarn/releases/yarn-3.5.1.cjs
|
||||||
|
|||||||
20
Dockerfile
20
Dockerfile
@@ -1,12 +1,14 @@
|
|||||||
ARG ENV=production
|
ARG ENV=production
|
||||||
ARG MONGO_VERSION=latest
|
|
||||||
ARG PORT=9001
|
ARG PORT=9001
|
||||||
ARG NPM_TOKEN=not_set
|
ARG NPM_TOKEN
|
||||||
ARG YARN_VERSION=3.5.0
|
ARG YARN_VERSION=3.5.0
|
||||||
|
ARG MONGO_ENTRY_FILE=${MONGO_VERSION:-latest}
|
||||||
|
ARG MONGO_VERSION=${MONGO_VERSION:-latest}
|
||||||
|
|
||||||
## mongo build stage
|
## mongo build stage
|
||||||
FROM mongo:$MONGO_VERSION AS database
|
FROM mongo:$MONGO_VERSION AS database
|
||||||
COPY docker-entrypoint-initdb.d/mongo-init-$MONGO_VERSION.sh ./docker-entrypoint-initdb.d/mongo-init.sh
|
ENV NODE_ENV $ENV
|
||||||
|
COPY docker-entrypoint-initdb.d/mongo-init-$MONGO_ENTRY_FILE.sh ./docker-entrypoint-initdb.d/mongo-init.sh
|
||||||
|
|
||||||
## stage one, build the service
|
## stage one, build the service
|
||||||
FROM node:20-bullseye-slim AS build
|
FROM node:20-bullseye-slim AS build
|
||||||
@@ -15,10 +17,10 @@ ENV NODE_ENV development
|
|||||||
ENV NPM_TOKEN $NPM_TOKEN
|
ENV NPM_TOKEN $NPM_TOKEN
|
||||||
WORKDIR /home/node/app
|
WORKDIR /home/node/app
|
||||||
COPY .npmrc /root
|
COPY .npmrc /root
|
||||||
COPY .yarnrc.build.yml /root/.yarnrc.yml
|
COPY .build.yarnrc.yml /root/.yarnrc.yml
|
||||||
COPY lib package*.json tsconfig.json yarn.lock ./
|
COPY . .
|
||||||
RUN yarn set version stable && yarn install
|
RUN yarn set version stable && yarn install
|
||||||
RUN yarn build
|
RUN yarn build:production
|
||||||
|
|
||||||
## this is stage two , where the app actually runs
|
## this is stage two , where the app actually runs
|
||||||
FROM node:20-bullseye-slim AS containerize
|
FROM node:20-bullseye-slim AS containerize
|
||||||
@@ -27,9 +29,9 @@ ENV NODE_ENV $ENV
|
|||||||
ENV NPM_TOKEN $NPM_TOKEN
|
ENV NPM_TOKEN $NPM_TOKEN
|
||||||
WORKDIR /home/node/app
|
WORKDIR /home/node/app
|
||||||
COPY .npmrc /root
|
COPY .npmrc /root
|
||||||
COPY .yarnrc.build.yml /root/.yarnrc.yml
|
COPY .build.yarnrc.yml /root/.yarnrc.yml
|
||||||
COPY package*.json yarn.lock ./
|
COPY package*.json yarn.lock ./
|
||||||
RUN yarn set version stable && yarn install && yarn cache clean
|
RUN yarn set version stable && yarn install && yarn cache clean
|
||||||
COPY --from=build /home/node/app/dist .
|
COPY --from=build /home/node/app/dist ./
|
||||||
EXPOSE $PORT
|
EXPOSE $PORT
|
||||||
CMD ["node","server/index.js"]
|
CMD ["node","index.js"]
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ services:
|
|||||||
context: .
|
context: .
|
||||||
target: database
|
target: database
|
||||||
args:
|
args:
|
||||||
MONGO_VERSION: 6.0.5
|
MONGO_VERSION: latest
|
||||||
ports:
|
ports:
|
||||||
- 27017:27017
|
- 27017:27017
|
||||||
networks:
|
networks:
|
||||||
@@ -17,7 +17,7 @@ services:
|
|||||||
- auth-db:/data/db
|
- auth-db:/data/db
|
||||||
- auth-db:/data/configdb
|
- auth-db:/data/configdb
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
image: mongo:latest
|
image: ${CONTAINER_PREFIX}-auth-service_mongo:${TAG:-latest}
|
||||||
auth-service:
|
auth-service:
|
||||||
env_file: .env.dev
|
env_file: .env.dev
|
||||||
build:
|
build:
|
||||||
@@ -37,7 +37,7 @@ services:
|
|||||||
- labs-net
|
- labs-net
|
||||||
- backend
|
- backend
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
image: node:20-alpine
|
image: ${CONTAINER_PREFIX}-auth-service:${TAG:-latest}
|
||||||
depends_on:
|
depends_on:
|
||||||
- auth-service_mongo
|
- auth-service_mongo
|
||||||
networks:
|
networks:
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ services:
|
|||||||
- 'auth-db:/data/db'
|
- 'auth-db:/data/db'
|
||||||
- 'auth-db:/data/configdb'
|
- 'auth-db:/data/configdb'
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
image: mongo:4.4
|
image: ${CONTAINER_PREFIX}auth-service_mongo:${DRONE_TAG:-latest}
|
||||||
auth-service:
|
auth-service:
|
||||||
container_name: ${CONTAINER_PREFIX}-auth-service
|
container_name: ${CONTAINER_PREFIX}-auth-service
|
||||||
env_file:
|
env_file:
|
||||||
@@ -42,7 +42,7 @@ services:
|
|||||||
- auth-backend
|
- auth-backend
|
||||||
- docknet
|
- docknet
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
image: node:20-alpine
|
image: ${CONTAINER_PREFIX}auth-service:${DRONE_TAG:-latest}
|
||||||
depends_on:
|
depends_on:
|
||||||
- auth-service_mongo
|
- auth-service_mongo
|
||||||
networks:
|
networks:
|
||||||
|
|||||||
20
package.json
20
package.json
@@ -1,17 +1,18 @@
|
|||||||
{
|
{
|
||||||
"name": "@mifi/auth-service",
|
"name": "@mifi/auth-service",
|
||||||
"version": "1.0.2",
|
"version": "1.0.9",
|
||||||
"author": "mifi (Mike Fitzpatrick)",
|
"author": "mifi (Mike Fitzpatrick)",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "tsc",
|
"build": "tsc",
|
||||||
"build:production": "tsc -p .",
|
"build:production": "tsc -p ./tsconfig.production.json",
|
||||||
"format": "prettier:fix && lint:fix",
|
"format": "prettier:fix && lint:fix",
|
||||||
"lint": "eslint --ext .ts,.tsx lib/",
|
"lint": "eslint --ext .ts,.tsx src/",
|
||||||
"lint:fix": "eslint --fix --ext .ts,.tsx lib/",
|
"lint:fix": "eslint --fix --ext .ts,.tsx src/",
|
||||||
"prettier": "prettier --check 'lib/**/*.ts'",
|
"prettier": "prettier --check 'src/**/*.ts'",
|
||||||
"prettier:fix": "prettier --write 'lib/**/*.ts'",
|
"prettier:fix": "prettier --write 'src/**/*.ts'",
|
||||||
"serve": "node dist/lib/index.js",
|
"serve-dev": "ts-node src/index.ts",
|
||||||
|
"serve": "node lib/index.js",
|
||||||
"start": "nodemon",
|
"start": "nodemon",
|
||||||
"test": "jest --passWithNoTests"
|
"test": "jest --passWithNoTests"
|
||||||
},
|
},
|
||||||
@@ -80,6 +81,7 @@
|
|||||||
"description": "",
|
"description": "",
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://git.mifi.dev/mifi/auth-api.git"
|
"url": "https://git.mifi.dev/mifi/auth-service.git"
|
||||||
}
|
},
|
||||||
|
"packageManager": "yarn@3.5.1"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,11 +2,16 @@
|
|||||||
"extends": "@tsconfig/node16/tsconfig.json",
|
"extends": "@tsconfig/node16/tsconfig.json",
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"allowSyntheticDefaultImports": true,
|
"allowSyntheticDefaultImports": true,
|
||||||
|
"declaration": true,
|
||||||
"experimentalDecorators": true,
|
"experimentalDecorators": true,
|
||||||
"emitDecoratorMetadata": true,
|
"emitDecoratorMetadata": true,
|
||||||
"noImplicitAny": true,
|
"noImplicitAny": true,
|
||||||
"outDir": "./dist/",
|
"outDir": "dist/",
|
||||||
"rootDirs": ["lib"],
|
"rootDirs": ["./", "src/"],
|
||||||
"sourceMap": true
|
"strict": true,
|
||||||
}
|
"esModuleInterop": true,
|
||||||
|
"sourceMap": true,
|
||||||
|
"removeComments": false
|
||||||
|
},
|
||||||
|
"include": ["src"]
|
||||||
}
|
}
|
||||||
|
|||||||
17
tsconfig.production.json
Normal file
17
tsconfig.production.json
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
{
|
||||||
|
"extends": "@tsconfig/node16/tsconfig.json",
|
||||||
|
"compilerOptions": {
|
||||||
|
"allowSyntheticDefaultImports": true,
|
||||||
|
"declaration": true,
|
||||||
|
"experimentalDecorators": true,
|
||||||
|
"emitDecoratorMetadata": true,
|
||||||
|
"noImplicitAny": true,
|
||||||
|
"outDir": "dist/",
|
||||||
|
"rootDirs": ["./", "src/"],
|
||||||
|
"strict": true,
|
||||||
|
"esModuleInterop": true,
|
||||||
|
"sourceMap": false,
|
||||||
|
"removeComments": true
|
||||||
|
},
|
||||||
|
"include": ["./src"]
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user