Switch to npm, added docker setup
This commit is contained in:
parent
b0c2c217fe
commit
819379fba4
7 changed files with 1922 additions and 1024 deletions
5
.dockerignore
Normal file
5
.dockerignore
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
node_modules
|
||||||
|
dist
|
||||||
|
npm-debug.log
|
||||||
|
dockerfile
|
||||||
|
.dockerignore
|
|
@ -4,6 +4,8 @@ A self-hosted avatars API using some of the [DiceBear](https://www.dicebear.com/
|
||||||
|
|
||||||
# Installation
|
# Installation
|
||||||
|
|
||||||
|
## Development
|
||||||
|
|
||||||
For run locally it needs a `.env` file with the environment variables defined in the `.env.example`
|
For run locally it needs a `.env` file with the environment variables defined in the `.env.example`
|
||||||
|
|
||||||
ALLOWED_ORIGINS includes a comma separated list for the allowed CORS sites.
|
ALLOWED_ORIGINS includes a comma separated list for the allowed CORS sites.
|
||||||
|
@ -11,6 +13,10 @@ ALLOWED_ORIGINS includes a comma separated list for the allowed CORS sites.
|
||||||
Install dependencies `npm install` or `yarn`
|
Install dependencies `npm install` or `yarn`
|
||||||
To start the project run `npm run dev` or `yarn dev`
|
To start the project run `npm run dev` or `yarn dev`
|
||||||
|
|
||||||
|
## Production
|
||||||
|
|
||||||
|
For run it in docker just run `docker compose up`
|
||||||
|
|
||||||
## Libraries Used
|
## Libraries Used
|
||||||
|
|
||||||
- DiceBear (for avatar generation)
|
- DiceBear (for avatar generation)
|
||||||
|
|
17
docker-compose.yml
Normal file
17
docker-compose.yml
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
name: avatars
|
||||||
|
|
||||||
|
services:
|
||||||
|
api:
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
environment:
|
||||||
|
NODE_ENV: "production"
|
||||||
|
HOST: "0.0.0.0"
|
||||||
|
PORT: 3000
|
||||||
|
API_VERSION: 1
|
||||||
|
ALLOWED_ORIGINS: "http://localhost:3000,https://jusemon.com"
|
||||||
|
|
||||||
|
networks:
|
||||||
|
default:
|
||||||
|
name: default-network
|
||||||
|
external: true
|
16
dockerfile
Normal file
16
dockerfile
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
#Build stage
|
||||||
|
FROM node:18-alpine AS build
|
||||||
|
WORKDIR /app
|
||||||
|
COPY package*.json .
|
||||||
|
RUN npm ci
|
||||||
|
COPY . .
|
||||||
|
RUN npm run build
|
||||||
|
|
||||||
|
#Prod stage
|
||||||
|
FROM node:18-alpine AS production
|
||||||
|
WORKDIR /app
|
||||||
|
COPY package*.json .
|
||||||
|
RUN npm ci --omit=dev
|
||||||
|
COPY --from=build /app/dist ./dist
|
||||||
|
|
||||||
|
CMD ["npm", "run", "start"]
|
1877
package-lock.json
generated
Normal file
1877
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load diff
|
@ -7,8 +7,7 @@
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "npx tsc",
|
"build": "npx tsc",
|
||||||
"start": "node --experimental-specifier-resolution=node dist/index.js",
|
"start": "node --experimental-specifier-resolution=node dist/index.js",
|
||||||
"dev": "tsx watch src/index.ts",
|
"dev": "tsx watch src/index.ts"
|
||||||
"preinstall": "yarn config set ignore-engines true"
|
|
||||||
},
|
},
|
||||||
"keywords": [],
|
"keywords": [],
|
||||||
"author": "",
|
"author": "",
|
||||||
|
|
Loading…
Reference in a new issue