mirror of
https://github.com/SyncrowIOT/backend.git
synced 2025-07-16 02:36:19 +00:00
Merge branch 'dev' into create-group-endpoint
This commit is contained in:
7
.github/workflows/dev_syncrow(dev).yml
vendored
7
.github/workflows/dev_syncrow(dev).yml
vendored
@ -1,4 +1,4 @@
|
||||
name: Auth and Backend using Docker to Azure App Service
|
||||
name: Backend deployment to Azure App Service
|
||||
|
||||
on:
|
||||
push:
|
||||
@ -30,9 +30,6 @@ jobs:
|
||||
npm install
|
||||
npm run build
|
||||
|
||||
- name: List build output
|
||||
run: ls -R dist/apps/
|
||||
|
||||
- name: Log in to Azure
|
||||
uses: azure/login@v1
|
||||
with:
|
||||
@ -42,7 +39,7 @@ jobs:
|
||||
run: az acr login --name ${{ env.ACR_REGISTRY }}
|
||||
|
||||
- name: List build output
|
||||
run: ls -R dist/apps/
|
||||
run: ls -R dist/
|
||||
|
||||
- name: Build and push Docker image
|
||||
run: |
|
||||
|
@ -1,19 +1,16 @@
|
||||
FROM node:20-alpine
|
||||
|
||||
RUN apk add --no-cache nginx
|
||||
|
||||
COPY nginx.conf /etc/nginx/nginx.conf
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY package*.json ./
|
||||
|
||||
RUN npm install
|
||||
RUN npm install -g @nestjs/cli
|
||||
|
||||
COPY . .
|
||||
|
||||
RUN npm run build
|
||||
|
||||
EXPOSE 8080
|
||||
EXPOSE 4000
|
||||
|
||||
CMD ["sh", "-c", "nginx -g 'daemon off;' & npm run start:all"]
|
||||
CMD ["npm", "run", "start"]
|
||||
|
38
nginx.conf
38
nginx.conf
@ -1,38 +0,0 @@
|
||||
worker_processes 1;
|
||||
|
||||
events {
|
||||
worker_connections 1024;
|
||||
}
|
||||
|
||||
http {
|
||||
include mime.types;
|
||||
default_type application/octet-stream;
|
||||
sendfile on;
|
||||
keepalive_timeout 65;
|
||||
|
||||
server {
|
||||
listen 8080;
|
||||
|
||||
location /auth {
|
||||
proxy_pass http://localhost:4001;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
}
|
||||
|
||||
location / {
|
||||
proxy_pass http://localhost:4000;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
}
|
||||
|
||||
# error pages
|
||||
error_page 500 502 503 504 /50x.html;
|
||||
location = /50x.html {
|
||||
root /usr/share/nginx/html;
|
||||
}
|
||||
}
|
||||
}
|
2
package-lock.json
generated
2
package-lock.json
generated
@ -35,7 +35,7 @@
|
||||
"typeorm": "^0.3.20"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@nestjs/cli": "^10.0.0",
|
||||
"@nestjs/cli": "^10.3.2",
|
||||
"@nestjs/schematics": "^10.0.0",
|
||||
"@nestjs/testing": "^10.0.0",
|
||||
"@types/express": "^4.17.17",
|
||||
|
@ -8,7 +8,7 @@
|
||||
"scripts": {
|
||||
"build": "npx nest build",
|
||||
"format": "prettier --write \"apps/**/*.ts\" \"libs/**/*.ts\"",
|
||||
"start": "npx nest start",
|
||||
"start": "node dist/main",
|
||||
"start:dev": "npx nest start --watch",
|
||||
"start:debug": "npx nest start --debug --watch",
|
||||
"start:prod": "node dist/main",
|
||||
@ -46,7 +46,7 @@
|
||||
"typeorm": "^0.3.20"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@nestjs/cli": "^10.0.0",
|
||||
"@nestjs/cli": "^10.3.2",
|
||||
"@nestjs/schematics": "^10.0.0",
|
||||
"@nestjs/testing": "^10.0.0",
|
||||
"@types/express": "^4.17.17",
|
||||
|
10
src/main.ts
10
src/main.ts
@ -8,12 +8,6 @@ import { ValidationPipe } from '@nestjs/common';
|
||||
async function bootstrap() {
|
||||
const app = await NestFactory.create(AuthModule);
|
||||
|
||||
// Enable 'trust proxy' setting
|
||||
app.use((req, res, next) => {
|
||||
app.getHttpAdapter().getInstance().set('trust proxy', 1);
|
||||
next();
|
||||
});
|
||||
|
||||
app.enableCors();
|
||||
|
||||
app.use(
|
||||
@ -33,7 +27,7 @@ async function bootstrap() {
|
||||
|
||||
app.useGlobalPipes(new ValidationPipe());
|
||||
|
||||
await app.listen(4001);
|
||||
await app.listen(process.env.PORT || 4000);
|
||||
}
|
||||
console.log('Starting auth at port 4001...');
|
||||
console.log('Starting auth at port ...', process.env.PORT || 4000);
|
||||
bootstrap();
|
||||
|
Reference in New Issue
Block a user