fix: Docker compose build for production
This commit is contained in:
13
Dockerfile
13
Dockerfile
@@ -12,6 +12,10 @@ RUN npm i
|
|||||||
|
|
||||||
RUN npm run build
|
RUN npm run build
|
||||||
|
|
||||||
|
RUN npm i --prefix backend
|
||||||
|
|
||||||
|
RUN npm run build --prefix backend
|
||||||
|
|
||||||
FROM --platform=linux/amd64 node:18-alpine as production
|
FROM --platform=linux/amd64 node:18-alpine as production
|
||||||
|
|
||||||
RUN mkdir -p /usr/src/app
|
RUN mkdir -p /usr/src/app
|
||||||
@@ -19,10 +23,11 @@ WORKDIR /usr/src/app
|
|||||||
|
|
||||||
ENV NODE_ENV=production
|
ENV NODE_ENV=production
|
||||||
|
|
||||||
COPY --from=pre-production /usr/src/app/build ./build
|
COPY --from=pre-production /usr/src/app/backend/dist ./dist
|
||||||
|
COPY --from=pre-production /usr/src/app/dist ./dist/dist
|
||||||
|
|
||||||
COPY package.json .
|
COPY backend/package.json .
|
||||||
COPY package-lock.json .
|
COPY backend/package-lock.json .
|
||||||
|
|
||||||
RUN npm ci --omit dev
|
RUN npm ci --omit dev
|
||||||
|
|
||||||
@@ -30,7 +35,7 @@ RUN mkdir -p ./config
|
|||||||
|
|
||||||
RUN ln -s /usr/src/app/config /config
|
RUN ln -s /usr/src/app/config /config
|
||||||
|
|
||||||
CMD [ "npm", "run", "deploy" ]
|
CMD [ "npm", "run", "start:prod" ]
|
||||||
|
|
||||||
FROM node:18 as development
|
FROM node:18 as development
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ import { join } from 'path';
|
|||||||
UserModule,
|
UserModule,
|
||||||
AuthModule,
|
AuthModule,
|
||||||
ServeStaticModule.forRoot({
|
ServeStaticModule.forRoot({
|
||||||
rootPath: join(__dirname, '..', '..', 'dist'),
|
rootPath: join(__dirname, 'dist'),
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
controllers: [AppController],
|
controllers: [AppController],
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ export const databaseProviders = [
|
|||||||
useFactory: async () => {
|
useFactory: async () => {
|
||||||
const dataSource = new DataSource({
|
const dataSource = new DataSource({
|
||||||
type: 'sqlite',
|
type: 'sqlite',
|
||||||
database: './reiverr.sqlite',
|
database: './config/reiverr.sqlite',
|
||||||
entities: [__dirname + '/../**/*.entity{.ts,.js}'],
|
entities: [__dirname + '/../**/*.entity{.ts,.js}'],
|
||||||
synchronize: true,
|
synchronize: true,
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { AppModule } from './app.module';
|
|||||||
import 'reflect-metadata';
|
import 'reflect-metadata';
|
||||||
import { DocumentBuilder, SwaggerModule } from '@nestjs/swagger';
|
import { DocumentBuilder, SwaggerModule } from '@nestjs/swagger';
|
||||||
import * as fs from 'fs';
|
import * as fs from 'fs';
|
||||||
import * as proxy from 'express-http-proxy';
|
// import * as proxy from 'express-http-proxy';
|
||||||
|
|
||||||
async function bootstrap() {
|
async function bootstrap() {
|
||||||
const app = await NestFactory.create(AppModule);
|
const app = await NestFactory.create(AppModule);
|
||||||
@@ -20,6 +20,6 @@ async function bootstrap() {
|
|||||||
SwaggerModule.setup('openapi', app, document);
|
SwaggerModule.setup('openapi', app, document);
|
||||||
fs.writeFileSync('./swagger-spec.json', JSON.stringify(document));
|
fs.writeFileSync('./swagger-spec.json', JSON.stringify(document));
|
||||||
|
|
||||||
await app.listen(3000);
|
await app.listen(9494);
|
||||||
}
|
}
|
||||||
bootstrap();
|
bootstrap();
|
||||||
|
|||||||
@@ -8,4 +8,4 @@ services:
|
|||||||
image: ghcr.io/aleksilassila/reiverr:latest
|
image: ghcr.io/aleksilassila/reiverr:latest
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
volumes:
|
volumes:
|
||||||
- ./config:/config
|
- ./backend/config:/usr/src/app/config
|
||||||
|
|||||||
@@ -38,7 +38,7 @@
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<I18n />
|
<I18n />
|
||||||
<Container class="w-full h-full overflow-auto text-white">
|
<Container class="w-full h-full overflow-auto text-white scrollbar-hide">
|
||||||
{#if $appState.user === undefined}
|
{#if $appState.user === undefined}
|
||||||
<div class="h-full w-full flex flex-col items-center justify-center">
|
<div class="h-full w-full flex flex-col items-center justify-center">
|
||||||
<div class="flex items-center justify-center hover:text-inherit selectable rounded-sm mb-2">
|
<div class="flex items-center justify-center hover:text-inherit selectable rounded-sm mb-2">
|
||||||
|
|||||||
Reference in New Issue
Block a user