mirror of
https://github.com/immich-app/immich.git
synced 2025-01-23 20:22:45 +01: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:
parent
9cbd5d1b0c
commit
ac0ad98b55
11 changed files with 42 additions and 69 deletions
|
@ -34,7 +34,8 @@ Loading ~4000 images/videos
|
||||||
<p align="left">
|
<p align="left">
|
||||||
<img src="design/nsc1.png" width="150" title="Login With Custom URL">
|
<img src="design/nsc1.png" width="150" title="Login With Custom URL">
|
||||||
<img src="design/nsc2.png" width="150" title="Backup Setting Info">
|
<img src="design/nsc2.png" width="150" title="Backup Setting Info">
|
||||||
<img src="design/nsc3.png" width="150" title="Multiple seelct">
|
<img src="design/nsc3.png" width="150" title="Multiple select">
|
||||||
|
<img src="design/nsc4.jpeg" width="150" title="Curated Search Info">
|
||||||
<img src="design/nsc6.png" width="150" title="EXIF Info">
|
<img src="design/nsc6.png" width="150" title="EXIF Info">
|
||||||
|
|
||||||
</p>
|
</p>
|
||||||
|
|
BIN
design/nsc4.jpeg
Normal file
BIN
design/nsc4.jpeg
Normal file
Binary file not shown.
After (image error) Size: 406 KiB |
|
@ -1,6 +1,3 @@
|
||||||
# STAGE
|
|
||||||
NODE_ENV=development
|
|
||||||
|
|
||||||
# Database
|
# Database
|
||||||
DB_USERNAME=postgres
|
DB_USERNAME=postgres
|
||||||
DB_PASSWORD=postgres
|
DB_PASSWORD=postgres
|
||||||
|
|
|
@ -5,7 +5,6 @@ services:
|
||||||
image: immich-server-dev:1.3.2
|
image: immich-server-dev:1.3.2
|
||||||
build:
|
build:
|
||||||
context: ../server
|
context: ../server
|
||||||
target: development
|
|
||||||
dockerfile: ../server/Dockerfile
|
dockerfile: ../server/Dockerfile
|
||||||
command: npm run start:dev
|
command: npm run start:dev
|
||||||
expose:
|
expose:
|
||||||
|
@ -16,6 +15,8 @@ services:
|
||||||
- /usr/src/app/node_modules
|
- /usr/src/app/node_modules
|
||||||
env_file:
|
env_file:
|
||||||
- .env
|
- .env
|
||||||
|
environment:
|
||||||
|
- NODE_ENV=development
|
||||||
depends_on:
|
depends_on:
|
||||||
- redis
|
- redis
|
||||||
- database
|
- database
|
||||||
|
@ -26,7 +27,6 @@ services:
|
||||||
image: immich-microservices-dev:1.3.2
|
image: immich-microservices-dev:1.3.2
|
||||||
build:
|
build:
|
||||||
context: ../microservices
|
context: ../microservices
|
||||||
target: development
|
|
||||||
dockerfile: ../microservices/Dockerfile
|
dockerfile: ../microservices/Dockerfile
|
||||||
command: npm run start:dev
|
command: npm run start:dev
|
||||||
expose:
|
expose:
|
||||||
|
@ -37,6 +37,8 @@ services:
|
||||||
- /usr/src/app/node_modules
|
- /usr/src/app/node_modules
|
||||||
env_file:
|
env_file:
|
||||||
- .env
|
- .env
|
||||||
|
environment:
|
||||||
|
- NODE_ENV=development
|
||||||
depends_on:
|
depends_on:
|
||||||
- database
|
- database
|
||||||
networks:
|
networks:
|
||||||
|
|
|
@ -5,7 +5,6 @@ services:
|
||||||
image: immich-server-dev:1.4.0
|
image: immich-server-dev:1.4.0
|
||||||
build:
|
build:
|
||||||
context: ../server
|
context: ../server
|
||||||
target: development
|
|
||||||
dockerfile: ../server/Dockerfile
|
dockerfile: ../server/Dockerfile
|
||||||
command: npm run start:dev
|
command: npm run start:dev
|
||||||
expose:
|
expose:
|
||||||
|
@ -26,7 +25,6 @@ services:
|
||||||
image: immich-microservices-dev:1.4.0
|
image: immich-microservices-dev:1.4.0
|
||||||
build:
|
build:
|
||||||
context: ../microservices
|
context: ../microservices
|
||||||
target: development
|
|
||||||
dockerfile: ../microservices/Dockerfile
|
dockerfile: ../microservices/Dockerfile
|
||||||
command: npm run start:dev
|
command: npm run start:dev
|
||||||
deploy:
|
deploy:
|
||||||
|
|
|
@ -5,7 +5,6 @@ services:
|
||||||
image: immich-server:1.4.0
|
image: immich-server:1.4.0
|
||||||
build:
|
build:
|
||||||
context: ../server
|
context: ../server
|
||||||
target: production
|
|
||||||
dockerfile: ../server/Dockerfile
|
dockerfile: ../server/Dockerfile
|
||||||
command: npm run start:prod
|
command: npm run start:prod
|
||||||
expose:
|
expose:
|
||||||
|
@ -16,6 +15,8 @@ services:
|
||||||
- /usr/src/app/node_modules
|
- /usr/src/app/node_modules
|
||||||
env_file:
|
env_file:
|
||||||
- .env
|
- .env
|
||||||
|
environment:
|
||||||
|
- NODE_ENV=production
|
||||||
depends_on:
|
depends_on:
|
||||||
- redis
|
- redis
|
||||||
- database
|
- database
|
||||||
|
@ -26,7 +27,6 @@ services:
|
||||||
image: immich-microservices:1.4.0
|
image: immich-microservices:1.4.0
|
||||||
build:
|
build:
|
||||||
context: ../microservices
|
context: ../microservices
|
||||||
target: production
|
|
||||||
dockerfile: ../microservices/Dockerfile
|
dockerfile: ../microservices/Dockerfile
|
||||||
command: npm run start:prod
|
command: npm run start:prod
|
||||||
expose:
|
expose:
|
||||||
|
@ -37,6 +37,8 @@ services:
|
||||||
- /usr/src/app/node_modules
|
- /usr/src/app/node_modules
|
||||||
env_file:
|
env_file:
|
||||||
- .env
|
- .env
|
||||||
|
environment:
|
||||||
|
- NODE_ENV=production
|
||||||
depends_on:
|
depends_on:
|
||||||
- database
|
- database
|
||||||
networks:
|
networks:
|
||||||
|
|
|
@ -1,7 +1,4 @@
|
||||||
##################################
|
FROM node:16-bullseye-slim
|
||||||
# DEVELOPMENT
|
|
||||||
##################################
|
|
||||||
FROM node:16-bullseye-slim AS development
|
|
||||||
|
|
||||||
ARG DEBIAN_FRONTEND=noninteractive
|
ARG DEBIAN_FRONTEND=noninteractive
|
||||||
|
|
||||||
|
@ -17,27 +14,3 @@ RUN npm install
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
RUN npm run build
|
RUN npm run build
|
||||||
|
|
||||||
#################################
|
|
||||||
# PRODUCTION
|
|
||||||
#################################
|
|
||||||
FROM node:16-bullseye-slim 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 apt-get update
|
|
||||||
RUN apt-get install gcc g++ make cmake python3 python3-pip ffmpeg -y
|
|
||||||
|
|
||||||
RUN npm install --only=production
|
|
||||||
|
|
||||||
COPY . .
|
|
||||||
|
|
||||||
COPY --from=development /usr/src/app/dist ./dist
|
|
||||||
|
|
||||||
CMD ["node", "dist/main"]
|
|
|
@ -1,10 +1,25 @@
|
||||||
import { NestFactory } from '@nestjs/core';
|
import { NestFactory } from '@nestjs/core';
|
||||||
import { AppModule } from './app.module';
|
import { AppModule } from './app.module';
|
||||||
|
import { Logger } from '@nestjs/common';
|
||||||
|
|
||||||
async function bootstrap() {
|
async function bootstrap() {
|
||||||
const app = await NestFactory.create(AppModule);
|
const app = await NestFactory.create(AppModule);
|
||||||
|
|
||||||
await app.listen(3001);
|
await app.listen(3001, () => {
|
||||||
|
if (process.env.NODE_ENV == 'development') {
|
||||||
|
Logger.log(
|
||||||
|
'Running Immich Microservices in DEVELOPMENT environment',
|
||||||
|
'IMMICH MICROSERVICES',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (process.env.NODE_ENV == 'production') {
|
||||||
|
Logger.log(
|
||||||
|
'Running Immich Microservices in PRODUCTION environment',
|
||||||
|
'IMMICH MICROSERVICES',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
bootstrap();
|
bootstrap();
|
||||||
|
|
|
@ -1,7 +1,4 @@
|
||||||
##################################
|
FROM node:16-alpine3.14
|
||||||
# DEVELOPMENT
|
|
||||||
##################################
|
|
||||||
FROM node:16-alpine3.14 AS development
|
|
||||||
|
|
||||||
ARG DEBIAN_FRONTEND=noninteractive
|
ARG DEBIAN_FRONTEND=noninteractive
|
||||||
|
|
||||||
|
@ -15,27 +12,4 @@ RUN npm install
|
||||||
|
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
RUN npm run build
|
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"]
|
|
|
@ -46,6 +46,8 @@ import { CommunicationModule } from './api-v1/communication/communication.module
|
||||||
})
|
})
|
||||||
export class AppModule implements NestModule {
|
export class AppModule implements NestModule {
|
||||||
configure(consumer: MiddlewareConsumer): void {
|
configure(consumer: MiddlewareConsumer): void {
|
||||||
// consumer.apply(AppLoggerMiddleware).forRoutes('*');
|
if (process.env.NODE_ENV == 'development') {
|
||||||
|
consumer.apply(AppLoggerMiddleware).forRoutes('*');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { Logger } from '@nestjs/common';
|
||||||
import { NestFactory } from '@nestjs/core';
|
import { NestFactory } from '@nestjs/core';
|
||||||
import { NestExpressApplication } from '@nestjs/platform-express';
|
import { NestExpressApplication } from '@nestjs/platform-express';
|
||||||
import { AppModule } from './app.module';
|
import { AppModule } from './app.module';
|
||||||
|
@ -10,6 +11,14 @@ async function bootstrap() {
|
||||||
|
|
||||||
app.useWebSocketAdapter(new RedisIoAdapter(app));
|
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();
|
bootstrap();
|
||||||
|
|
Loading…
Reference in a new issue