mirror of
https://github.com/dadosfera/maestro.git
synced 2026-08-31 19:58:21 +00:00
FEAT: dev docker
This commit is contained in:
@@ -6,29 +6,18 @@ on:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
test:
|
test:
|
||||||
runs-on: [self-hosted, prd]
|
runs-on: [self-hosted, prd]
|
||||||
|
env:
|
||||||
|
APP_NAME: ${{ github.event.repository.name }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Configure AWS
|
|
||||||
uses: aws-actions/configure-aws-credentials@v4
|
|
||||||
id: aws
|
|
||||||
with:
|
|
||||||
aws-region: us-east-1
|
|
||||||
|
|
||||||
- name: Build
|
- name: Build
|
||||||
env:
|
run: docker build -t ${APP_NAME}_teste --target test .
|
||||||
APP_NAME: ${{ github.event.repository.name }}
|
|
||||||
run: |
|
|
||||||
docker build -t $APP_NAME --target test .
|
|
||||||
|
|
||||||
- name: Run Test
|
- name: Run Test
|
||||||
env:
|
run: docker run ${APP_NAME}_teste
|
||||||
ENV: test
|
|
||||||
APP_NAME: ${{ github.event.repository.name }}
|
|
||||||
run: |
|
|
||||||
docker run --rm --entrypoint="npm" $APP_NAME run test
|
|
||||||
|
|
||||||
- name: Remove Docker's Trash
|
- name: Remove Docker's Trash
|
||||||
if: always()
|
if: always()
|
||||||
|
|||||||
+37
-16
@@ -1,21 +1,42 @@
|
|||||||
# install all dependencies
|
FROM node:18.17-alpine AS base_image
|
||||||
FROM node:18.17-alpine as packages
|
|
||||||
|
FROM base_image AS build_base
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY package.json package-lock.json ./
|
RUN apk update
|
||||||
RUN apk add --no-cache aws-cli \
|
# needed packages to build dependencies from source
|
||||||
&& aws codeartifact login --tool npm --namespace @dadosfera --repository dadosfera-npm --domain dadosfera --domain-owner 611330257153 --region us-east-1 \
|
RUN apk add --no-cache aws-cli
|
||||||
&& npm install
|
COPY package*.json ./
|
||||||
|
|
||||||
|
|
||||||
|
# run aws cli without mounting secret, because CI already has AWS credentials
|
||||||
|
FROM build_base AS ci_image
|
||||||
|
RUN aws codeartifact login --tool npm --namespace @dadosfera --repository dadosfera-npm --domain dadosfera --domain-owner 611330257153 --region us-east-1
|
||||||
|
RUN npm ci
|
||||||
|
COPY . .
|
||||||
|
|
||||||
|
|
||||||
# unit test specific build
|
# unit test specific build
|
||||||
FROM node:18.17-alpine as test
|
FROM ci_image AS test
|
||||||
WORKDIR /app
|
ENTRYPOINT ["npm", "run", "test"]
|
||||||
COPY --from=packages /app/node_modules ./node_modules
|
|
||||||
COPY . ./
|
|
||||||
|
|
||||||
FROM node:18.17-alpine
|
|
||||||
WORKDIR /app
|
# dev build
|
||||||
COPY . /app/
|
FROM build_base AS dev
|
||||||
COPY --from=packages /app/node_modules ./node_modules
|
RUN --mount=type=secret,id=aws,target=/root/.aws/credentials \
|
||||||
|
aws codeartifact login --tool npm --namespace @dadosfera --repository dadosfera-npm --domain dadosfera --domain-owner 611330257153 --region us-east-1
|
||||||
|
# flag --build-from-source is required to force-build sqlite3
|
||||||
|
RUN npm ci
|
||||||
|
COPY . .
|
||||||
|
ENTRYPOINT npm run start:dev
|
||||||
|
|
||||||
|
|
||||||
|
FROM ci_image AS prod_build
|
||||||
RUN npm run build
|
RUN npm run build
|
||||||
EXPOSE 3333
|
|
||||||
ENTRYPOINT npm run start
|
|
||||||
|
FROM base_image
|
||||||
|
WORKDIR /app
|
||||||
|
COPY --from=prod_build /app/dist ./dist
|
||||||
|
COPY --from=prod_build /app/node_modules ./node_modules
|
||||||
|
COPY --from=prod_build /app/package*.json ./
|
||||||
|
ENTRYPOINT npm run start:prod
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
version: "3.8"
|
|
||||||
services:
|
services:
|
||||||
maestro:
|
maestro:
|
||||||
build: .
|
build: .
|
||||||
image: dadosfera/maestro_${ENV}:${IMAGE_TAG}
|
image: dadosfera/maestro_${ENV}:${IMAGE_TAG}
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
version: "3.8"
|
|
||||||
services:
|
services:
|
||||||
maestro:
|
maestro:
|
||||||
build: .
|
build: .
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
version: "3.8"
|
|
||||||
services:
|
services:
|
||||||
maestro:
|
maestro:
|
||||||
image: dadosfera/maestro_${ENV}:${IMAGE_TAG}
|
image: dadosfera/maestro_${ENV}:${IMAGE_TAG}
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
version: "3.8"
|
|
||||||
services:
|
services:
|
||||||
maestro:
|
maestro:
|
||||||
image: ${ACCOUNT_ID}.dkr.ecr.us-east-1.amazonaws.com/microservices/maestro_${ENV}:${IMAGE_TAG}
|
image: ${ACCOUNT_ID}.dkr.ecr.us-east-1.amazonaws.com/microservices/maestro_${ENV}:${IMAGE_TAG}
|
||||||
|
|||||||
+2
-2
@@ -5447,7 +5447,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"info": {
|
"info": {
|
||||||
"title": "Maestro - feat/rls",
|
"title": "Maestro",
|
||||||
"description": "This is the Maestro API",
|
"description": "This is the Maestro API",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"contact": {}
|
"contact": {}
|
||||||
@@ -8238,4 +8238,4 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Generated
+1
-2
@@ -7,7 +7,6 @@
|
|||||||
"": {
|
"": {
|
||||||
"name": "maestro",
|
"name": "maestro",
|
||||||
"version": "0.0.0",
|
"version": "0.0.0",
|
||||||
"hasInstallScript": true,
|
|
||||||
"license": "UNLICENSED",
|
"license": "UNLICENSED",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@aws-sdk/client-secrets-manager": "^3.414.0",
|
"@aws-sdk/client-secrets-manager": "^3.414.0",
|
||||||
@@ -77,7 +76,7 @@
|
|||||||
"typescript": "^4.9.5"
|
"typescript": "^4.9.5"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": "^18.17.0"
|
"node": "18.17"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@ampproject/remapping": {
|
"node_modules/@ampproject/remapping": {
|
||||||
|
|||||||
+3
-3
@@ -6,10 +6,10 @@
|
|||||||
"private": true,
|
"private": true,
|
||||||
"license": "UNLICENSED",
|
"license": "UNLICENSED",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": "^18.17.0"
|
"node": "18.17"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"preinstall": "aws codeartifact login --tool npm --namespace @dadosfera --repository dadosfera-npm --domain dadosfera --domain-owner 611330257153 --region us-east-1",
|
"co:login": "aws codeartifact login --tool npm --namespace @dadosfera --repository dadosfera-npm --domain dadosfera --domain-owner 611330257153 --region us-east-1",
|
||||||
"proto-update": "npm i @dadosfera/protospack-v2@latest --save-exact",
|
"proto-update": "npm i @dadosfera/protospack-v2@latest --save-exact",
|
||||||
"prebuild": "rimraf dist",
|
"prebuild": "rimraf dist",
|
||||||
"build": "nest build",
|
"build": "nest build",
|
||||||
@@ -20,7 +20,7 @@
|
|||||||
"start:prod": "node dist/main",
|
"start:prod": "node dist/main",
|
||||||
"docs": "export KILL_AFTER_START=1 && nest start && export INTERNAL_SWAGGER=true && nest start",
|
"docs": "export KILL_AFTER_START=1 && nest start && export INTERNAL_SWAGGER=true && nest start",
|
||||||
"lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix",
|
"lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix",
|
||||||
"test": "jest",
|
"test": "jest --detectOpenHandles --forceExit",
|
||||||
"test:watch": "jest --watch",
|
"test:watch": "jest --watch",
|
||||||
"test:cov": "jest --coverage",
|
"test:cov": "jest --coverage",
|
||||||
"test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand",
|
"test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand",
|
||||||
|
|||||||
@@ -6,7 +6,9 @@ import {
|
|||||||
import { credentials } from '@grpc/grpc-js';
|
import { credentials } from '@grpc/grpc-js';
|
||||||
import { Catalog } from '@dadosfera/protospack-v2';
|
import { Catalog } from '@dadosfera/protospack-v2';
|
||||||
|
|
||||||
const isLocalConnection = !!process.env.PIFACTORY_URL?.includes('0.0.0.0');
|
const isLocalConnection =
|
||||||
|
process.env.PIFACTORY_URL.startsWith('pi-factory:') ||
|
||||||
|
process.env.PIFACTORY_URL?.includes('0.0.0.0');
|
||||||
|
|
||||||
export class CatalogClientConfiguration {
|
export class CatalogClientConfiguration {
|
||||||
public name = 'CatalogClientConfiguration';
|
public name = 'CatalogClientConfiguration';
|
||||||
|
|||||||
@@ -6,7 +6,9 @@ import {
|
|||||||
} from '@nestjs/microservices';
|
} from '@nestjs/microservices';
|
||||||
import { ConnectionTest } from '@dadosfera/protospack-v2';
|
import { ConnectionTest } from '@dadosfera/protospack-v2';
|
||||||
|
|
||||||
const isLocalConnection = !!process.env.INFACTORY_URL?.includes('0.0.0.0');
|
const isLocalConnection =
|
||||||
|
process.env.INFACTORY_URL.startsWith('in-factory:') ||
|
||||||
|
process.env.INFACTORY_URL.includes('0.0.0.0');
|
||||||
|
|
||||||
export class ConnectionTestClientConfiguration {
|
export class ConnectionTestClientConfiguration {
|
||||||
private config: GrpcOptions = {
|
private config: GrpcOptions = {
|
||||||
|
|||||||
@@ -6,7 +6,9 @@ import {
|
|||||||
} from '@nestjs/microservices';
|
} from '@nestjs/microservices';
|
||||||
import { ConnectionManager } from '@dadosfera/protospack-v2';
|
import { ConnectionManager } from '@dadosfera/protospack-v2';
|
||||||
|
|
||||||
const isLocalConnection = !!process.env.INFACTORY_URL?.includes('0.0.0.0');
|
const isLocalConnection =
|
||||||
|
process.env.INFACTORY_URL.startsWith('in-factory:') ||
|
||||||
|
process.env.INFACTORY_URL.includes('0.0.0.0');
|
||||||
|
|
||||||
export class ConnectionClientConfiguration {
|
export class ConnectionClientConfiguration {
|
||||||
public name = 'ConnectionClientConfiguration';
|
public name = 'ConnectionClientConfiguration';
|
||||||
|
|||||||
@@ -6,7 +6,9 @@ import {
|
|||||||
} from '@nestjs/microservices';
|
} from '@nestjs/microservices';
|
||||||
import { ConnectorManager } from '@dadosfera/protospack-v2';
|
import { ConnectorManager } from '@dadosfera/protospack-v2';
|
||||||
|
|
||||||
const isLocalConnection = !!process.env.INFACTORY_URL?.includes('0.0.0.0');
|
const isLocalConnection =
|
||||||
|
process.env.INFACTORY_URL.startsWith('in-factory:') ||
|
||||||
|
process.env.INFACTORY_URL.includes('0.0.0.0');
|
||||||
|
|
||||||
export class ConnectorClientConfiguration {
|
export class ConnectorClientConfiguration {
|
||||||
public name = 'ConnectorClientConfiguration';
|
public name = 'ConnectorClientConfiguration';
|
||||||
|
|||||||
@@ -9,7 +9,9 @@ import {
|
|||||||
ProtoPaths,
|
ProtoPaths,
|
||||||
} from '@dadosfera/protospack-v2/dist/lib/Duc';
|
} from '@dadosfera/protospack-v2/dist/lib/Duc';
|
||||||
|
|
||||||
const isLocalConnection = !!process.env.DUC_URL?.includes('0.0.0.0');
|
const isLocalConnection =
|
||||||
|
process.env.DUC_URL.startsWith('duc:') ||
|
||||||
|
!!process.env.DUC_URL?.includes('0.0.0.0');
|
||||||
|
|
||||||
export class DucClient {
|
export class DucClient {
|
||||||
public name = 'DucClient';
|
public name = 'DucClient';
|
||||||
|
|||||||
@@ -6,7 +6,9 @@ import {
|
|||||||
type GrpcOptions,
|
type GrpcOptions,
|
||||||
} from '@nestjs/microservices';
|
} from '@nestjs/microservices';
|
||||||
|
|
||||||
const isLocalConnection = !!process.env.INFACTORY_URL?.includes('0.0.0.0');
|
const isLocalConnection =
|
||||||
|
process.env.INFACTORY_URL.startsWith('in-factory:') ||
|
||||||
|
process.env.INFACTORY_URL.includes('0.0.0.0');
|
||||||
export class InputsGrpcClient {
|
export class InputsGrpcClient {
|
||||||
public readonly name = 'InputsGrpcClient';
|
public readonly name = 'InputsGrpcClient';
|
||||||
private config: GrpcOptions = {
|
private config: GrpcOptions = {
|
||||||
|
|||||||
@@ -6,7 +6,9 @@ import {
|
|||||||
} from '@nestjs/microservices';
|
} from '@nestjs/microservices';
|
||||||
import { NetworkConfig } from '@dadosfera/protospack-v2';
|
import { NetworkConfig } from '@dadosfera/protospack-v2';
|
||||||
|
|
||||||
const isLocalConnection = !!process.env.INFACTORY_URL?.includes('0.0.0.0');
|
const isLocalConnection =
|
||||||
|
process.env.INFACTORY_URL.startsWith('in-factory:') ||
|
||||||
|
process.env.INFACTORY_URL.includes('0.0.0.0');
|
||||||
|
|
||||||
export class NetworkConfigGrpcClient {
|
export class NetworkConfigGrpcClient {
|
||||||
public name = 'NetworkConfigGrpcClient';
|
public name = 'NetworkConfigGrpcClient';
|
||||||
|
|||||||
@@ -6,7 +6,9 @@ import {
|
|||||||
import { PipelinePackages, PipelineProtoFilePath } from '@dadosfera/protospack';
|
import { PipelinePackages, PipelineProtoFilePath } from '@dadosfera/protospack';
|
||||||
import { credentials } from '@grpc/grpc-js';
|
import { credentials } from '@grpc/grpc-js';
|
||||||
|
|
||||||
const isLocalConnection = !!process.env.PIFACTORY_URL?.includes('0.0.0.0');
|
const isLocalConnection =
|
||||||
|
process.env.PIFACTORY_URL.startsWith('pi-factory:') ||
|
||||||
|
process.env.PIFACTORY_URL?.includes('0.0.0.0');
|
||||||
|
|
||||||
export class PipelinesClientConfiguration {
|
export class PipelinesClientConfiguration {
|
||||||
public name = 'PipelinesClientConfiguration';
|
public name = 'PipelinesClientConfiguration';
|
||||||
|
|||||||
@@ -9,7 +9,9 @@ import {
|
|||||||
} from '@dadosfera/protospack-v2/dist/lib/PipelineV2';
|
} from '@dadosfera/protospack-v2/dist/lib/PipelineV2';
|
||||||
import { credentials } from '@grpc/grpc-js';
|
import { credentials } from '@grpc/grpc-js';
|
||||||
|
|
||||||
const isLocalConnection = !!process.env.PIFACTORY_URL?.includes('0.0.0.0');
|
const isLocalConnection =
|
||||||
|
process.env.PIFACTORY_URL.startsWith('pi-factory:') ||
|
||||||
|
!!process.env.PIFACTORY_URL?.includes('0.0.0.0');
|
||||||
|
|
||||||
export class PipelinesClientConfiguration {
|
export class PipelinesClientConfiguration {
|
||||||
public name = 'PipelinesClientConfiguration';
|
public name = 'PipelinesClientConfiguration';
|
||||||
|
|||||||
@@ -6,7 +6,9 @@ import {
|
|||||||
import { credentials } from '@grpc/grpc-js';
|
import { credentials } from '@grpc/grpc-js';
|
||||||
import { Transformation } from '@dadosfera/protospack-v2';
|
import { Transformation } from '@dadosfera/protospack-v2';
|
||||||
|
|
||||||
const isLocalConnection = !!process.env.INFACTORY_URL?.includes('0.0.0.0');
|
const isLocalConnection =
|
||||||
|
process.env.INFACTORY_URL.startsWith('in-factory:') ||
|
||||||
|
process.env.INFACTORY_URL.includes('0.0.0.0');
|
||||||
|
|
||||||
export class TransformationsClientConfiguration {
|
export class TransformationsClientConfiguration {
|
||||||
public name = 'TransformationsClientConfiguration';
|
public name = 'TransformationsClientConfiguration';
|
||||||
|
|||||||
Reference in New Issue
Block a user