Skip to content
Snippets Groups Projects
Commit 81a49c8d authored by Charles-Francis Damedey's avatar Charles-Francis Damedey Committed by Charles-Francis Damedey
Browse files

misc: add Dockerfile

GitLab: #1
Change-Id: If58557b5d9679a74d00a6dca497f26789c747a12
parent c38be0ca
Branches
No related tags found
No related merge requests found
# Stage 1: Base Image
FROM node:18-alpine as base
WORKDIR /api
COPY package*.json ./
RUN npm install
COPY . .
ENV DATA_DIRECTORY=/data
# Stage 2: Final Image for running the server
FROM base as server
EXPOSE 3000
CMD ["npm", "run", "start"]
# Stage 3: Final Image for running the tests
FROM base as test
CMD ["npm", "run", "test"]
\ No newline at end of file
# Plugin Store
# Plugins Store
The idea is to provide the user a quick way to discover and install plugins via the plugin store.
# Prerequisites
+ npm
+ Node.js 18.16+
+ Docker
# Installation of Node.js 18.16
how to install Node.js 18.16 with nvm
`$ curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash`
`$ wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash`
`$ export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"\n[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm`
`$ command -v nvm`
how to install Node.js 18.16 with nvm
`$ nvm install 18.16.0`
# Scripts
run the server
`$ npm run start`
lint
`$ npm run lint`
fix the linting
`$ npm run fix`
run tests and see code coverage
`$ npm run test`
# Send API requests
### Get all plugins
`$ curl -X GET http://localhost:3000/`
### Get a plugin's details
`$ curl -X GET http://localhost:3000/details/AudioFilter`
### Download a plugin by its id
`$ curl -X GET http://localhost:3000/download/AudioFilter.jpl`
# Contributing
We have a set of ESLint rules that define clear syntax rules (web/.eslintrc.json). You will need the following tools:
We have a set of ESLint rules that define clear syntax rules (/.eslintrc.json). You will need the following tools:
* ESLint (The pluggable linting utility for JavaScript and JSX) https://eslint.org/
* ESLint (https://eslint.org/)
We will not accept patches introducing non-ESLint-compliant code.
## Linting via pre-commit hook
# Docker
To install Docker please read this manual: https://docs.docker.com/engine/install/ubuntu/#install-using-the-repository
The Docker needs a data directory to store the plugins. You need a /data/ folder in your repo. The API will look for the plugins in this folder. This is a temporary situation until we have a database implemented.
Build a docker image:
`docker build -t server-image --target server .`
Run the docker container:
`docker run -p 3000:3000 -ti server-image`
To stop the container do CTRL + C in the terminal.
To run tests in the docker container
Build the test image:
`docker build -t test-image --target test .`
Run the test image:
`docker run test-image`
# Linting via pre-commit hook
Set up the pre-commit hook:
......
......@@ -7,7 +7,8 @@
"start": "ts-node index.ts",
"build": "tsc",
"lint": "eslint . --ext .ts",
"fix": "eslint . --ext .ts --fix"
"fix": "eslint . --ext .ts --fix",
"build": "tsc"
},
"author": "",
"license": "ISC",
......
......@@ -15,7 +15,7 @@ The endpoint to retrieve the list of plugins needs to support a per-page query p
### Code Example
```http
GET /plugins/
GET
```
Successful response:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment