refactor: app deployment

This commit is contained in:
2023-06-05 10:54:18 +02:00
parent b21833de40
commit 3b8a344d73
104 changed files with 583 additions and 13494 deletions

View File

@@ -1,8 +1,14 @@
FROM registry.gitlab.com/openstapps/projectmanagement/node
FROM openstapps:workspace as pruned
ADD . /app
WORKDIR /app
USER root
RUN pnpm --filter @openstapps/api-cli --prod deploy /pruned
ENTRYPOINT ["node", "lib/cli.js"]
FROM registry.gitlab.com/openstapps/projectmanagement/node:v18
USER node
ENV NODE_ENV=production
COPY --chown=node:node --from=pruned pruned .
ENTRYPOINT ["node", "app.js"]
CMD ["--help"]

View File

@@ -1,7 +1,7 @@
{
"name": "@openstapps/api-cli",
"description": "CLI client for @openstapps/api",
"version": "2.1.0",
"version": "3.0.0",
"type": "module",
"license": "GPL-3.0-only",
"repository": "git@gitlab.com:openstapps/api.git",
@@ -18,25 +18,26 @@
"bin": {
"openstapps-api": "app.js"
},
"files": [
"app.js",
"lib",
"README.md"
],
"scripts": {
"build": "tsup",
"build": "tsup-node",
"build:docker": "docker build -t openstapps:api-cli .",
"format": "prettier . -c --ignore-path ../../.gitignore",
"format:fix": "prettier --write . --ignore-path ../../.gitignore",
"lint": "tsc --noEmit && eslint --ext .ts src/",
"lint:fix": "eslint --fix --ext .ts src/",
"test": "c8 mocha --exit"
},
"devDependencies": {
"dependencies": {
"@openstapps/api": "workspace:*",
"@openstapps/core": "workspace:*",
"@openstapps/core-tools": "workspace:*",
"@openstapps/eslint-config": "workspace:*",
"@openstapps/logger": "workspace:*",
"@openstapps/prettier-config": "workspace:*",
"@openstapps/tsconfig": "workspace:*",
"@types/chai": "4.3.5",
"@types/chai-as-promised": "7.1.5",
"@types/chai-spies": "1.0.3",
"@types/cli-progress": "3.11.0",
"@types/express": "4.17.17",
"@types/fs-extra": "9.0.13",
@@ -44,22 +45,26 @@
"@types/mocha": "10.0.1",
"@types/node": "18.15.3",
"@types/wait-on": "5.3.1",
"cli-progress": "3.12.0",
"commander": "10.0.0",
"fs-extra": "10.1.0",
"wait-on": "6.0.1"
},
"devDependencies": {
"@openstapps/prettier-config": "workspace:*",
"@openstapps/tsconfig": "workspace:*",
"@types/chai": "4.3.5",
"@types/chai-as-promised": "7.1.5",
"@types/chai-spies": "1.0.3",
"c8": "7.14.0",
"chai": "4.3.7",
"chai-as-promised": "7.1.1",
"chai-spies": "1.0.0",
"cli-progress": "3.12.0",
"commander": "10.0.0",
"fs-extra": "10.1.0",
"mocha": "10.2.0",
"nock": "13.3.1",
"ts-node": "10.9.1",
"tsup": "6.7.0",
"typescript": "4.9.5",
"wait-on": "6.0.1"
},
"peerDependencies": {
"@openstapps/core": "workspace:*"
"typescript": "4.9.5"
},
"tsup": {
"entry": [

View File

@@ -17,7 +17,7 @@ import {Logger} from '@openstapps/logger';
import {Command} from 'commander';
import {readFileSync} from 'fs';
import path from 'path';
import {URL} from 'url';
import {fileURLToPath, URL} from 'url';
import waitOn from 'wait-on';
import {HttpClient} from '@openstapps/api';
import {copy} from './copy.js';
@@ -29,7 +29,9 @@ process.on('unhandledRejection', async error => {
});
// eslint-disable-next-line unicorn/prefer-module
const packageJson = JSON.parse(readFileSync(path.join(__dirname, '..', 'package.json')).toString());
const packageJson = JSON.parse(
readFileSync(path.join(path.dirname(fileURLToPath(import.meta.url)), '..', 'package.json')).toString(),
);
const client = new HttpClient();
const commander = new Command();