mirror of https://github.com/immich-app/immich.git
Added successfully built docker-compose and cockerFile
parent
568cc243f0
commit
85b83f9666
@ -0,0 +1,3 @@
|
||||
node_modules/
|
||||
upload/
|
||||
dist/
|
||||
@ -0,0 +1,65 @@
|
||||
FROM ubuntu:20.04 AS development
|
||||
|
||||
ARG DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
WORKDIR /usr/src/app
|
||||
|
||||
COPY package.json yarn.lock ./
|
||||
|
||||
RUN apt-get update && apt-get install -y --fix-missing --no-install-recommends \
|
||||
build-essential \
|
||||
curl \
|
||||
git-core \
|
||||
iputils-ping \
|
||||
pkg-config \
|
||||
rsync \
|
||||
software-properties-common \
|
||||
unzip \
|
||||
wget
|
||||
|
||||
# Install NodeJS
|
||||
RUN curl --silent --location https://deb.nodesource.com/setup_14.x | bash -
|
||||
RUN apt-get install --yes nodejs
|
||||
|
||||
RUN npm i -g yarn
|
||||
|
||||
RUN yarn install
|
||||
|
||||
COPY . .
|
||||
|
||||
RUN yarn build
|
||||
|
||||
|
||||
FROM ubuntu:20.04 as production
|
||||
ARG DEBIAN_FRONTEND=noninteractive
|
||||
ARG NODE_ENV=production
|
||||
ENV NODE_ENV=${NODE_ENV}
|
||||
|
||||
WORKDIR /usr/src/app
|
||||
|
||||
COPY package.json yarn.lock ./
|
||||
|
||||
RUN apt-get update && apt-get install -y --fix-missing --no-install-recommends \
|
||||
build-essential \
|
||||
curl \
|
||||
git-core \
|
||||
iputils-ping \
|
||||
pkg-config \
|
||||
rsync \
|
||||
software-properties-common \
|
||||
unzip \
|
||||
wget
|
||||
|
||||
# Install NodeJS
|
||||
RUN curl --silent --location https://deb.nodesource.com/setup_14.x | bash -
|
||||
RUN apt-get install --yes nodejs
|
||||
|
||||
RUN npm i -g yarn
|
||||
|
||||
RUN yarn install --only=production
|
||||
|
||||
COPY . .
|
||||
|
||||
COPY --from=development /usr/src/app/dist ./dist
|
||||
|
||||
CMD ["node", "dist/main"]
|
||||
@ -0,0 +1,54 @@
|
||||
version: '3.8'
|
||||
|
||||
|
||||
services:
|
||||
server:
|
||||
container_name: immich_server
|
||||
image: immich-server-dev:1.0.0
|
||||
build:
|
||||
context: .
|
||||
target: development
|
||||
dockerfile: ./Dockerfile
|
||||
command: yarn start:dev
|
||||
ports:
|
||||
- "3000:3000"
|
||||
volumes:
|
||||
- .:/usr/src/app
|
||||
- userdata:/usr/src/app/upload
|
||||
- /usr/src/app/node_modules
|
||||
env_file:
|
||||
- .env
|
||||
depends_on:
|
||||
- redis
|
||||
- database
|
||||
networks:
|
||||
- immich_network
|
||||
|
||||
redis:
|
||||
container_name: immich_redis
|
||||
image: redis:6.2
|
||||
networks:
|
||||
- immich_network
|
||||
|
||||
database:
|
||||
container_name: immich_postgres
|
||||
image: postgres:14
|
||||
env_file:
|
||||
- .env
|
||||
environment:
|
||||
POSTGRES_PASSWORD: ${DB_PASSWORD}
|
||||
POSTGRES_USER: ${DB_USERNAME}
|
||||
POSTGRES_DB: ${DB_DATABASE_NAME}
|
||||
PG_DATA: /var/lib/postgresql/data
|
||||
volumes:
|
||||
- pgdata:/var/lib/postgresql/data
|
||||
ports:
|
||||
- 5432:5432
|
||||
networks:
|
||||
- immich_network
|
||||
|
||||
networks:
|
||||
immich_network:
|
||||
volumes:
|
||||
pgdata:
|
||||
userdata:
|
||||
@ -1,39 +1,39 @@
|
||||
import { Process, Processor } from '@nestjs/bull';
|
||||
import { InjectRepository } from '@nestjs/typeorm';
|
||||
import { Job } from 'bull';
|
||||
import { Repository } from 'typeorm';
|
||||
import { AssetEntity } from '../../api-v1/asset/entities/asset.entity';
|
||||
import sharp from 'sharp';
|
||||
import fs, { existsSync, mkdirSync } from 'fs';
|
||||
import { ConfigService } from '@nestjs/config';
|
||||
import * as tfnode from '@tensorflow/tfjs-node';
|
||||
import * as cocoSsd from '@tensorflow-models/coco-ssd';
|
||||
// import { Process, Processor } from '@nestjs/bull';
|
||||
// import { InjectRepository } from '@nestjs/typeorm';
|
||||
// import { Job } from 'bull';
|
||||
// import { Repository } from 'typeorm';
|
||||
// import { AssetEntity } from '../../api-v1/asset/entities/asset.entity';
|
||||
// import sharp from 'sharp';
|
||||
// import fs, { existsSync, mkdirSync } from 'fs';
|
||||
// import { ConfigService } from '@nestjs/config';
|
||||
// import * as tfnode from '@tensorflow/tfjs-node';
|
||||
// import * as cocoSsd from '@tensorflow-models/coco-ssd';
|
||||
|
||||
@Processor('machine-learning')
|
||||
export class MachineLearningProcessor {
|
||||
constructor(
|
||||
@InjectRepository(AssetEntity) private assetRepository: Repository<AssetEntity>,
|
||||
private configService: ConfigService,
|
||||
) {}
|
||||
// @Processor('machine-learning')
|
||||
// export class MachineLearningProcessor {
|
||||
// constructor(
|
||||
// @InjectRepository(AssetEntity) private assetRepository: Repository<AssetEntity>,
|
||||
// private configService: ConfigService,
|
||||
// ) {}
|
||||
|
||||
@Process('object-detection')
|
||||
async handleOptimization(job: Job) {
|
||||
try {
|
||||
const { resizePath }: { resizePath: string } = job.data;
|
||||
// @Process('object-detection')
|
||||
// async handleOptimization(job: Job) {
|
||||
// try {
|
||||
// const { resizePath }: { resizePath: string } = job.data;
|
||||
|
||||
const image = fs.readFileSync(resizePath);
|
||||
const decodedImage = tfnode.node.decodeImage(image, 3) as tfnode.Tensor3D;
|
||||
const model = await cocoSsd.load();
|
||||
const predictions = await model.detect(decodedImage);
|
||||
console.log('start predictions ------------------ ');
|
||||
for (var result of predictions) {
|
||||
console.log(`Found ${result.class} with score ${result.score}`);
|
||||
}
|
||||
console.log('end predictions ------------------ ');
|
||||
// const image = fs.readFileSync(resizePath);
|
||||
// const decodedImage = tfnode.node.decodeImage(image, 3) as tfnode.Tensor3D;
|
||||
// const model = await cocoSsd.load();
|
||||
// const predictions = await model.detect(decodedImage);
|
||||
// console.log('start predictions ------------------ ');
|
||||
// for (var result of predictions) {
|
||||
// console.log(`Found ${result.class} with score ${result.score}`);
|
||||
// }
|
||||
// console.log('end predictions ------------------ ');
|
||||
|
||||
return 'ok';
|
||||
} catch (e) {
|
||||
console.log('Error object detection ', e);
|
||||
}
|
||||
}
|
||||
}
|
||||
// return 'ok';
|
||||
// } catch (e) {
|
||||
// console.log('Error object detection ', e);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
Loading…
Reference in New Issue