mirror of
https://github.com/immich-app/immich.git
synced 2024-12-25 10:43:13 +02:00
Improve Docker setup and reduce memory usage of production containers (#338)
This commit is contained in:
parent
ae7e582ec8
commit
bece6253d5
@ -46,12 +46,12 @@ async function bootstrap() {
|
||||
customSiteTitle: 'Immich API Documentation',
|
||||
});
|
||||
|
||||
// Generate API Documentation
|
||||
const outputPath = path.resolve(process.cwd(), 'immich-openapi-specs.json');
|
||||
writeFileSync(outputPath, JSON.stringify(apiDocument), { encoding: 'utf8' });
|
||||
|
||||
await app.listen(3001, () => {
|
||||
if (process.env.NODE_ENV == 'development') {
|
||||
// Generate API Documentation only in development mode
|
||||
const outputPath = path.resolve(process.cwd(), 'immich-openapi-specs.json');
|
||||
writeFileSync(outputPath, JSON.stringify(apiDocument), { encoding: 'utf8' });
|
||||
Logger.log('Running Immich Server in DEVELOPMENT environment', 'ImmichServer');
|
||||
}
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
"license": "UNLICENSED",
|
||||
"scripts": {
|
||||
"prebuild": "rimraf dist",
|
||||
"build": "nest build",
|
||||
"build": "nest build immich && nest build microservices",
|
||||
"format": "prettier --write \"apps/**/*.ts\" \"libs/**/*.ts\"",
|
||||
"start": "nest start",
|
||||
"start:dev": "nest start --watch",
|
||||
|
@ -1 +1 @@
|
||||
npm start microservices
|
||||
node dist/apps/microservices/apps/microservices/src/main
|
@ -1 +1 @@
|
||||
npm start immich
|
||||
node dist/apps/immich/apps/immich/src/main
|
@ -5,35 +5,23 @@ WORKDIR /usr/src/app
|
||||
|
||||
RUN chown node:node /usr/src/app
|
||||
|
||||
COPY --chown=node:node package*.json ./
|
||||
RUN apk add --no-cache setpriv
|
||||
|
||||
RUN apk add --update-cache build-base python3
|
||||
COPY --chown=node:node package*.json ./
|
||||
|
||||
RUN npm ci
|
||||
|
||||
COPY --chown=node:node . .
|
||||
|
||||
EXPOSE 3000
|
||||
EXPOSE 24678
|
||||
|
||||
FROM base AS dev
|
||||
ENV CHOKIDAR_USEPOLLING=true
|
||||
EXPOSE 24678
|
||||
CMD ["npm", "run", "dev"]
|
||||
|
||||
FROM node:16-alpine3.14 as prod
|
||||
|
||||
WORKDIR /usr/src/app
|
||||
|
||||
RUN chown node:node /usr/src/app
|
||||
|
||||
COPY --chown=node:node package*.json ./
|
||||
COPY --chown=node:node . .
|
||||
|
||||
RUN apk add --update-cache build-base python3
|
||||
|
||||
RUN npm ci
|
||||
|
||||
EXPOSE 3000
|
||||
FROM base as prod
|
||||
ENV NODE_ENV=production
|
||||
|
||||
|
||||
# Issue build command in entrypoint.sh to capture user .env file instead of the builder .env file.
|
||||
|
@ -1 +1,6 @@
|
||||
npm run build && node /usr/src/app/build/index.js
|
||||
npm run build
|
||||
if [ `id -u` -eq 0 ] && [ -n "$PUID" ] && [ -n "$PGID" ]; then
|
||||
exec setpriv --reuid $PUID --regid $PGID --clear-groups node /usr/src/app/build/index.js
|
||||
else
|
||||
node /usr/src/app/build/index.js
|
||||
fi
|
@ -1,7 +1,7 @@
|
||||
import type { GetSession, Handle } from '@sveltejs/kit';
|
||||
import * as cookie from 'cookie';
|
||||
import { api } from '@api';
|
||||
import { AxiosError } from 'axios';
|
||||
import AxiosError from 'axios';
|
||||
|
||||
export const handle: Handle = async ({ event, resolve }) => {
|
||||
const cookies = cookie.parse(event.request.headers.get('cookie') || '');
|
||||
|
Loading…
Reference in New Issue
Block a user