mirror of
				https://github.com/KevinMidboe/immich.git
				synced 2025-10-29 17:40:28 +00:00 
			
		
		
		
	build(server): minimal container (#506)
* build(server): update Dockerfile * build(server): fix dockerfile * build(machine-learning): multiple build stages * build(server): update Dockerfile
This commit is contained in:
		@@ -1,4 +1,5 @@
 | 
			
		||||
FROM node:16-bullseye-slim
 | 
			
		||||
# Build stage
 | 
			
		||||
FROM node:16-bullseye-slim as builder
 | 
			
		||||
 | 
			
		||||
ARG DEBIAN_FRONTEND=noninteractive
 | 
			
		||||
 | 
			
		||||
@@ -15,3 +16,26 @@ RUN npm rebuild @tensorflow/tfjs-node --build-from-source
 | 
			
		||||
COPY . .
 | 
			
		||||
 | 
			
		||||
RUN npm run build
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
# Prod stage
 | 
			
		||||
FROM node:16-bullseye-slim
 | 
			
		||||
 | 
			
		||||
ARG DEBIAN_FRONTEND=noninteractive
 | 
			
		||||
 | 
			
		||||
WORKDIR /usr/src/app
 | 
			
		||||
 | 
			
		||||
COPY package.json package-lock.json ./
 | 
			
		||||
 | 
			
		||||
RUN mkdir -p /usr/src/app/dist \
 | 
			
		||||
    && mkdir -p /usr/src/app/node_modules \
 | 
			
		||||
    && apt-get update \
 | 
			
		||||
    && apt-get install -y ffmpeg \
 | 
			
		||||
    && rm -rf /var/cache/apt/lists
 | 
			
		||||
 | 
			
		||||
COPY --from=builder /usr/src/app/node_modules ./node_modules
 | 
			
		||||
COPY --from=builder /usr/src/app/dist ./dist
 | 
			
		||||
 | 
			
		||||
RUN npm prune --production
 | 
			
		||||
 | 
			
		||||
CMD [ "node", "dist/main" ]
 | 
			
		||||
 
 | 
			
		||||
@@ -1,15 +1,32 @@
 | 
			
		||||
FROM node:16-alpine3.14 as core
 | 
			
		||||
 | 
			
		||||
ARG DEBIAN_FRONTEND=noninteractive
 | 
			
		||||
# Build stage
 | 
			
		||||
FROM node:16-alpine3.14 as builder
 | 
			
		||||
 | 
			
		||||
WORKDIR /usr/src/app
 | 
			
		||||
 | 
			
		||||
COPY package.json package-lock.json ./
 | 
			
		||||
 | 
			
		||||
RUN apk add --update-cache build-base python3 libheif vips-dev vips ffmpeg
 | 
			
		||||
 | 
			
		||||
RUN apk add --update-cache build-base python3 libheif vips-dev
 | 
			
		||||
RUN npm ci
 | 
			
		||||
 | 
			
		||||
COPY . .
 | 
			
		||||
 | 
			
		||||
RUN npm run build
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
# Prod stage
 | 
			
		||||
FROM node:16-alpine3.14
 | 
			
		||||
 | 
			
		||||
WORKDIR /usr/src/app
 | 
			
		||||
 | 
			
		||||
COPY package.json package-lock.json ./
 | 
			
		||||
COPY start-server.sh start-microservices.sh ./
 | 
			
		||||
 | 
			
		||||
RUN mkdir -p /usr/src/app/dist \
 | 
			
		||||
    && apk add --no-cache libheif vips ffmpeg
 | 
			
		||||
 | 
			
		||||
COPY --from=builder /usr/src/app/node_modules ./node_modules
 | 
			
		||||
COPY --from=builder /usr/src/app/dist ./dist
 | 
			
		||||
 | 
			
		||||
RUN npm prune --production
 | 
			
		||||
 | 
			
		||||
EXPOSE 3001
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user