-
Notifications
You must be signed in to change notification settings - Fork 25
/
Dockerfile
61 lines (48 loc) · 1.68 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
57
58
59
60
61
FROM --platform=$BUILDPLATFORM node:14-alpine as node
ARG TARGETARCH
ARG TARGETVARIANT
WORKDIR /build/Bonsai
ADD src/Bonsai/package.json .
ADD src/Bonsai/package-lock.json .
RUN npm ci
ADD src/Bonsai .
RUN node_modules/.bin/gulp build
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:8.0-alpine as net-builder
ARG TARGETARCH
ARG TARGETVARIANT
WORKDIR /build
ADD src/Bonsai.sln .
ADD src/Bonsai/Bonsai.csproj Bonsai/
ADD src/Bonsai.Tests.Search/Bonsai.Tests.Search.csproj Bonsai.Tests.Search/
RUN --mount=type=cache,id=nuget-$TARGETARCH$TARGETVARIANT,sharing=locked,target=/root/.nuget/packages \
dotnet restore -a ${TARGETARCH/amd64/x64}
COPY --from=node /build .
RUN --mount=type=cache,id=nuget-$TARGETARCH$TARGETVARIANT,sharing=locked,target=/root/.nuget/packages \
dotnet publish Bonsai/Bonsai.csproj \
--output ../out/ \
--configuration Release \
-a ${TARGETARCH/amd64/x64} \
--self-contained true
FROM --platform=$TARGETPLATFORM alpine:latest
ARG TARGETARCH
ARG TARGETVARIANT
ARG BUILD_COMMIT
RUN --mount=type=cache,id=apk-$TARGETARCH$TARGETVARIANT,sharing=locked,target=/var/cache/apk \
apk --update add \
nodejs \
ffmpeg \
libintl \
icu \
icu-data-full \
&& apk add libgdiplus --repository=https://dl-cdn.alpinelinux.org/alpine/edge/testing/
WORKDIR /app
COPY --from=net-builder /out .
RUN mkdir /app/App_Data && chmod +w /app/App_Data
RUN mkdir /app/External/ffmpeg
RUN ln -s /usr/bin/ffmpeg /app/External/ffmpeg/ffmpeg && \
ln -s /usr/bin/ffprobe /app/External/ffmpeg/ffprobe && \
chmod +x /app/Bonsai
ENV ASPNETCORE_ENVIRONMENT=Production
ENV BuildCommit=$BUILD_COMMIT
EXPOSE 80
ENTRYPOINT ["/app/Bonsai"]