chore: docker changes

This commit is contained in:
apotdevin 2022-02-09 18:33:41 +01:00
parent bcea9bb62f
commit c88d3ede36
No known key found for this signature in database
GPG Key ID: 4403F1DFBE779457
10 changed files with 12 additions and 37 deletions

View File

@ -5,6 +5,7 @@
!README*.md !README*.md
/node_modules /node_modules
/.next /.next
src/client/.next
/dist /dist
/docs /docs
/.github /.github

View File

@ -1,5 +1,6 @@
node_modules node_modules
.next .next
src/client/.next
**/*.generated.tsx **/*.generated.tsx
src/graphql/types.ts src/graphql/types.ts

1
.gitignore vendored
View File

@ -2,6 +2,7 @@
/dist /dist
/node_modules /node_modules
/.next /.next
src/client/.next
# Logs # Logs
logs logs

View File

@ -58,7 +58,7 @@ COPY --from=build /app/node_modules/ ./node_modules
# Copy NextJS files # Copy NextJS files
COPY --from=build /app/src/client/public ./src/client/public COPY --from=build /app/src/client/public ./src/client/public
COPY --from=build /app/src/client/next.config.js ./src/client/ COPY --from=build /app/src/client/next.config.js ./src/client/
COPY --from=build /app/.next/ ./.next COPY --from=build /app/src/client/.next/ ./src/client/.next
# Copy NestJS files # Copy NestJS files
COPY --from=build /app/dist/ ./dist COPY --from=build /app/dist/ ./dist

View File

@ -58,7 +58,7 @@ COPY --from=build /app/node_modules/ ./node_modules
# Copy NextJS files # Copy NextJS files
COPY --from=build /app/src/client/public ./src/client/public COPY --from=build /app/src/client/public ./src/client/public
COPY --from=build /app/src/client/next.config.js ./src/client/ COPY --from=build /app/src/client/next.config.js ./src/client/
COPY --from=build /app/.next/ ./.next COPY --from=build /app/src/client/.next/ ./src/client/.next
# Copy NestJS files # Copy NestJS files
COPY --from=build /app/dist/ ./dist COPY --from=build /app/dist/ ./dist

View File

@ -58,7 +58,7 @@ COPY --from=build /app/node_modules/ ./node_modules
# Copy NextJS files # Copy NextJS files
COPY --from=build /app/src/client/public ./src/client/public COPY --from=build /app/src/client/public ./src/client/public
COPY --from=build /app/src/client/next.config.js ./src/client/ COPY --from=build /app/src/client/next.config.js ./src/client/
COPY --from=build /app/.next/ ./.next COPY --from=build /app/src/client/.next/ ./src/client/.next
# Copy NestJS files # Copy NestJS files
COPY --from=build /app/dist/ ./dist COPY --from=build /app/dist/ ./dist

View File

@ -8,9 +8,9 @@
"build": "npm run build:nest && npm run build:next", "build": "npm run build:nest && npm run build:next",
"build:nest": "nest build", "build:nest": "nest build",
"build:next": "cd src/client && next build", "build:next": "cd src/client && next build",
"build:image": "docker build --no-cache -t apotdevin/thunderhub:test-amd64 .", "build:image": "docker build -t apotdevin/thunderhub:test-amd64 .",
"build:image:base": "docker build --build-arg BASE_PATH=/thub --no-cache -t apotdevin/thunderhub:test-amd64 .", "build:image:base": "docker build --build-arg BASE_PATH=/thub -t apotdevin/thunderhub:test-amd64 .",
"build:32": "docker build --no-cache -f arm32v7.Dockerfile -t apotdevin/thunderhub:test-arm32v7 .", "build:32": "docker build -f arm32v7.Dockerfile -t apotdevin/thunderhub:test-arm32v7 .",
"build:64": "docker build -f arm64v8.Dockerfile -t apotdevin/thunderhub:test-arm64v8 .", "build:64": "docker build -f arm64v8.Dockerfile -t apotdevin/thunderhub:test-arm64v8 .",
"build:manifest": "docker manifest create apotdevin/thunderhub:test apotdevin/thunderhub:test-amd64 apotdevin/thunderhub:test-arm32v7 apotdevin/thunderhub:test-arm64v8", "build:manifest": "docker manifest create apotdevin/thunderhub:test apotdevin/thunderhub:test-amd64 apotdevin/thunderhub:test-arm32v7 apotdevin/thunderhub:test-arm64v8",
"build:all": "sh ./scripts/buildAllImages.sh", "build:all": "sh ./scripts/buildAllImages.sh",

View File

@ -8,7 +8,6 @@ dotenv.config({ path: path.resolve(process.cwd(), '.env') });
module.exports = { module.exports = {
reactStrictMode: true, reactStrictMode: true,
distDir: '../../.next',
poweredByHeader: false, poweredByHeader: false,
basePath: process.env.BASE_PATH || '', basePath: process.env.BASE_PATH || '',
publicRuntimeConfig: { publicRuntimeConfig: {

View File

@ -42,7 +42,6 @@ export type JwtObjectType = {
SubModule, SubModule,
WsModule, WsModule,
ApiModule, ApiModule,
ViewModule,
NodeModule, NodeModule,
AuthenticationModule, AuthenticationModule,
FilesModule, FilesModule,
@ -108,6 +107,8 @@ export type JwtObjectType = {
: combine(timestamp(), prettyPrint()), : combine(timestamp(), prettyPrint()),
}), }),
}), }),
// ViewModule has to be the last because of the wildcard controller
ViewModule,
], ],
}) })
export class AppModule {} export class AppModule {}

View File

@ -4,41 +4,13 @@ import { Request, Response } from 'express';
import { Public } from '../security/security.decorators'; import { Public } from '../security/security.decorators';
import { ViewService } from './view.service'; import { ViewService } from './view.service';
const NEXT_ROUTES = [
// Assets
'static*',
'assets*',
'_next*',
'favicon.ico',
// Routes
'',
'scores*',
'settings*',
'chain',
'channels*',
'chat',
'dashboard',
'forwards',
'leaderboard',
'lnmarkets',
'login',
'peers',
'rebalance',
'sso',
'stats',
'swap',
'token',
'tools',
'transactions',
];
@Public() @Public()
@SkipThrottle() @SkipThrottle()
@Controller('/') @Controller('/')
export class ViewController { export class ViewController {
constructor(private viewService: ViewService) {} constructor(private viewService: ViewService) {}
@Get(NEXT_ROUTES) @Get('*')
public async showHome(@Req() req: Request, @Res() res: Response) { public async showHome(@Req() req: Request, @Res() res: Response) {
await this.viewService.handler(req, res); await this.viewService.handler(req, res);
} }