-
Notifications
You must be signed in to change notification settings - Fork 19
/
Dockerfile
46 lines (32 loc) · 1.08 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# Stage 1: Base for building the .NET API
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:8.0 AS base-api
COPY . /source
WORKDIR /source/ImmichFrame.WebApi
# Set default architecture argument for multi-arch builds
ARG TARGETARCH
# Restore dependencies with cache
RUN dotnet restore
# Stage 2: Publish .NET API
FROM base-api AS publish-api
ARG TARGETARCH
# Publish the app for the target architecture
RUN dotnet publish --runtime linux-${TARGETARCH} --self-contained false -o /app
# Stage 3: Build frontend with Node.js
FROM node:18-alpine AS build-node
USER node
WORKDIR /app
COPY --chown=node:node ./immichFrame.Web/package*.json ./
# Cache npm dependencies
RUN npm ci
COPY --chown=node:node ./immichFrame.Web ./
RUN npm run build && npm prune --omit=dev
# Stage 4: Final production stage
FROM mcr.microsoft.com/dotnet/aspnet:8.0-jammy AS final
WORKDIR /app
# Copy .NET API and frontend assets
COPY --from=publish-api /app ./
COPY --from=build-node /app/build ./wwwroot
# Set non-privileged user
ARG APP_UID=1000
USER $APP_UID
ENTRYPOINT ["dotnet", "ImmichFrame.WebApi.dll"]