-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
56 lines (42 loc) · 1.51 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
47
48
49
50
51
52
53
54
55
56
# Build Stage
FROM mcr.microsoft.com/dotnet/sdk:9.0-alpine AS backend-build
WORKDIR /src
# Copy the rest of the source code
COPY src/ .
# Restore dependencies
RUN dotnet restore "PlexLocalScan.Api/PlexLocalScan.Api.csproj" && \
dotnet publish "PlexLocalScan.Api/PlexLocalScan.Api.csproj" -c Release -o /app/publish
# Frontend Build Stage
FROM node:20-slim AS frontend-build
ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH"
RUN corepack enable
RUN corepack prepare [email protected] --activate
WORKDIR /mediaflick
# Copy frontend files
COPY mediaflick/package*.json mediaflick/pnpm-lock.yaml ./
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile
COPY mediaflick .
RUN pnpm run build
# Runtime Stage
FROM mcr.microsoft.com/dotnet/aspnet:9.0-alpine
WORKDIR /app
RUN apk add --no-cache icu-libs nodejs
# Create necessary directories
RUN mkdir -p config/logs && mkdir -p /mnt/zurg/tvseries && mkdir -p /mnt/zurg/movies \
&& mkdir -p /mnt/organized/tvseries && mkdir -p /mnt/organized/movies
# Copy the published backend app
COPY --from=backend-build /app/publish .
# Copy the built frontend app
COPY --from=frontend-build /mediaflick/.next/standalone ./
COPY --from=frontend-build /mediaflick/.next/static ./.next/static
# Set environment variable for timezone and globalization
ENV DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=false
ENV NODE_ENV=production
# Expose only the frontend port
EXPOSE 3000
EXPOSE 5000
# Start both services using a shell script
COPY start.sh .
RUN chmod +x start.sh
ENTRYPOINT ["./start.sh"]