1
0
mirror of https://github.com/immich-app/immich.git synced 2025-08-09 23:17:29 +02:00

Fix docker-compose in production (#81)

* Fixed problem with docker-compose not updating new files in the multi-stage build.
* Update readme with a new screenshot
This commit is contained in:
Alex
2022-03-28 15:21:15 -05:00
committed by GitHub
parent 9cbd5d1b0c
commit ac0ad98b55
11 changed files with 42 additions and 69 deletions

View File

@@ -1,7 +1,4 @@
##################################
# DEVELOPMENT
##################################
FROM node:16-alpine3.14 AS development
FROM node:16-alpine3.14
ARG DEBIAN_FRONTEND=noninteractive
@@ -15,27 +12,4 @@ RUN npm install
COPY . .
RUN npm run build
#################################
# PRODUCTION
#################################
FROM node:16-alpine3.14 AS production
ARG DEBIAN_FRONTEND=noninteractive
ARG NODE_ENV=production
ENV NODE_ENV=${NODE_ENV}
WORKDIR /usr/src/app
COPY package.json package-lock.json ./
RUN apk add --update-cache build-base python3
RUN npm install --only=production
COPY . .
COPY --from=development /usr/src/app/dist ./dist
CMD ["node", "dist/main"]
RUN npm run build

View File

@@ -46,6 +46,8 @@ import { CommunicationModule } from './api-v1/communication/communication.module
})
export class AppModule implements NestModule {
configure(consumer: MiddlewareConsumer): void {
// consumer.apply(AppLoggerMiddleware).forRoutes('*');
if (process.env.NODE_ENV == 'development') {
consumer.apply(AppLoggerMiddleware).forRoutes('*');
}
}
}

View File

@@ -1,3 +1,4 @@
import { Logger } from '@nestjs/common';
import { NestFactory } from '@nestjs/core';
import { NestExpressApplication } from '@nestjs/platform-express';
import { AppModule } from './app.module';
@@ -10,6 +11,14 @@ async function bootstrap() {
app.useWebSocketAdapter(new RedisIoAdapter(app));
await app.listen(3000);
await app.listen(3000, () => {
if (process.env.NODE_ENV == 'development') {
Logger.log('Running Immich Server in DEVELOPMENT environment', 'IMMICH SERVER');
}
if (process.env.NODE_ENV == 'production') {
Logger.log('Running Immich Server in PRODUCTION environment', 'IMMICH SERVER');
}
});
}
bootstrap();