Skip to content

Commit

Permalink
feat: Add package command (#106)
Browse files Browse the repository at this point in the history
  • Loading branch information
erezrokah authored Dec 18, 2023
1 parent 765cd05 commit f2f7931
Show file tree
Hide file tree
Showing 16 changed files with 2,193 additions and 1,346 deletions.
4 changes: 4 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
dist-dir
node_modules
npm-debug.log
.env
13 changes: 9 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '16'
node-version: '20'
cache: 'npm'

- name: Install dependencies
Expand All @@ -31,12 +31,17 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '16'
node-version: '20'
cache: 'npm'

- name: Install dependencies
run: npm ci

-
# Required for the package command tests to work
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Test
run: |
npm test
Expand All @@ -47,7 +52,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '16'
node-version: '20'
cache: 'npm'

- name: Install dependencies
Expand All @@ -63,7 +68,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '16'
node-version: '20'
cache: 'npm'

- name: Install dependencies
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -132,3 +132,6 @@ dist
# Editor settings
.idea
.vscode

dist-dir
.DS_Store
27 changes: 27 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
FROM node:20-slim as builder

WORKDIR /app

COPY package*.json ./

RUN npm ci

COPY . .

RUN npm run build

FROM node:20-slim AS final

WORKDIR /app

COPY --from=builder ./app/dist ./dist

COPY package*.json ./

RUN npm ci --omit=dev

EXPOSE 7777

ENTRYPOINT ["node", "dist/main.js"]

CMD [ "serve", "--address", "[::]:7777", "--log-format", "json", "--log-level", "info" ]
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ This is the high-level package to use for developing CloudQuery plugins in JavaS

## Prerequisites

Node.js 16 or higher. Install Node.js from [here](https://nodejs.org/en/download/).
Node.js 20 or higher. Install Node.js from [here](https://nodejs.org/en/download/).

## Setup

Expand All @@ -29,7 +29,13 @@ npm test
### Start a local memory based plugin server

```bash
npm run dev
npm run dev -- serve
```

### Package as a Docker image

```bash
npm run dev -- package -m test "v1.0.0" . --dist-dir dist-dir
```

### Formatting and Linting
Expand Down
3 changes: 3 additions & 0 deletions docs/overview.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# MemDB Plugin

Test docs for the MemDB plugin.
Loading

0 comments on commit f2f7931

Please sign in to comment.