mirror of
https://github.com/apricote/Listory.git
synced 2026-01-13 13:11:02 +00:00
feat: serve frontend from api container in prod build
This commit is contained in:
parent
49bff95ea5
commit
ad98ce4e88
5 changed files with 24 additions and 1 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -1,5 +1,6 @@
|
||||||
# compiled output
|
# compiled output
|
||||||
/dist
|
/dist
|
||||||
|
/build
|
||||||
/node_modules
|
/node_modules
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -45,6 +45,6 @@ LABEL stage="app"
|
||||||
|
|
||||||
RUN npm ci --only=production
|
RUN npm ci --only=production
|
||||||
COPY --from=build-api /app/dist/ /app/dist/
|
COPY --from=build-api /app/dist/ /app/dist/
|
||||||
COPY --from=build-frontend /app/frontend/dist /app/static/
|
COPY --from=build-frontend /app/frontend/build /app/static/
|
||||||
|
|
||||||
CMD ["dist/main"]
|
CMD ["dist/main"]
|
||||||
|
|
|
||||||
15
package-lock.json
generated
15
package-lock.json
generated
|
|
@ -1328,6 +1328,21 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"@nestjs/serve-static": {
|
||||||
|
"version": "2.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@nestjs/serve-static/-/serve-static-2.1.0.tgz",
|
||||||
|
"integrity": "sha512-syC7x3vacNYOAqpITqiPd7NS0gAc3IbzexyMOpUu00mVt/8NZc3zXNEV5r4DeatRKUwc11tt1TRlMEsmTLTQIA==",
|
||||||
|
"requires": {
|
||||||
|
"path-to-regexp": "0.1.7"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"path-to-regexp": {
|
||||||
|
"version": "0.1.7",
|
||||||
|
"resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz",
|
||||||
|
"integrity": "sha1-32BBeABfUi8V60SQ5yR6G/qmf4w="
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"@nestjs/swagger": {
|
"@nestjs/swagger": {
|
||||||
"version": "4.5.3",
|
"version": "4.5.3",
|
||||||
"resolved": "https://registry.npmjs.org/@nestjs/swagger/-/swagger-4.5.3.tgz",
|
"resolved": "https://registry.npmjs.org/@nestjs/swagger/-/swagger-4.5.3.tgz",
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,7 @@
|
||||||
"@nestjs/passport": "^7.0.0",
|
"@nestjs/passport": "^7.0.0",
|
||||||
"@nestjs/platform-express": "^7.0.9",
|
"@nestjs/platform-express": "^7.0.9",
|
||||||
"@nestjs/schedule": "^0.3.1",
|
"@nestjs/schedule": "^0.3.1",
|
||||||
|
"@nestjs/serve-static": "^2.1.0",
|
||||||
"@nestjs/swagger": "^4.5.3",
|
"@nestjs/swagger": "^4.5.3",
|
||||||
"@nestjs/typeorm": "^7.0.0",
|
"@nestjs/typeorm": "^7.0.0",
|
||||||
"class-transformer": "^0.2.3",
|
"class-transformer": "^0.2.3",
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
import { Module } from "@nestjs/common";
|
import { Module } from "@nestjs/common";
|
||||||
import { ConfigModule } from "@nestjs/config";
|
import { ConfigModule } from "@nestjs/config";
|
||||||
import { ScheduleModule } from "@nestjs/schedule";
|
import { ScheduleModule } from "@nestjs/schedule";
|
||||||
|
import { ServeStaticModule } from "@nestjs/serve-static";
|
||||||
|
import { join } from "path";
|
||||||
import { AuthModule } from "./auth/auth.module";
|
import { AuthModule } from "./auth/auth.module";
|
||||||
import { DatabaseModule } from "./database/database.module";
|
import { DatabaseModule } from "./database/database.module";
|
||||||
import { ListensModule } from "./listens/listens.module";
|
import { ListensModule } from "./listens/listens.module";
|
||||||
|
|
@ -14,6 +16,10 @@ import { UsersModule } from "./users/users.module";
|
||||||
ConfigModule.forRoot({ isGlobal: true }),
|
ConfigModule.forRoot({ isGlobal: true }),
|
||||||
ScheduleModule.forRoot(),
|
ScheduleModule.forRoot(),
|
||||||
DatabaseModule,
|
DatabaseModule,
|
||||||
|
ServeStaticModule.forRoot({
|
||||||
|
rootPath: join(__dirname, "..", "static"),
|
||||||
|
exclude: ["/api*"],
|
||||||
|
}),
|
||||||
AuthModule,
|
AuthModule,
|
||||||
UsersModule,
|
UsersModule,
|
||||||
SourcesModule,
|
SourcesModule,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue