Repository navigation
Expand file tree
/
Copy pathDockerfile.build
More file actions
126 lines (92 loc) · 4.67 KB
/
Copy pathDockerfile.build
File metadata and controls
126 lines (92 loc) · 4.67 KB
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
# This Dockerfile is meant to be run in a CI/CD pipeline to build the OpenBullet2 project.
# -------
# BACKEND
# -------
FROM mcr.microsoft.com/dotnet/sdk:10.0-noble@sha256:c0790639332692a0d56cdd81ed581cfd24d040d9839764c138994866df89a3b6 AS backend
WORKDIR /code
COPY . .
# Build all release artifacts in a single layer. Splitting every publish into its own RUN
# makes BuildKit keep large cumulative self-contained publish snapshots, which can exhaust
# the GitHub-hosted runner disk when exporting the artifact build cache.
RUN dotnet run --project Tools/CurlImpersonate.NativeAssets -- --rid all \
&& dotnet publish OpenBullet2.Native -c Release -r win-x64 --self-contained true -p:PlaywrightPlatform=win -o /build/native-win-x64 \
&& dotnet publish OpenBullet2.Native -c Release -r win-arm64 --self-contained true -p:PlaywrightPlatform=win -o /build/native-win-arm64 \
&& dotnet publish OpenBullet2.Web -c Release -r win-x64 --self-contained true -p:PlaywrightPlatform=win -o /build/web-win-x64 \
&& dotnet publish OpenBullet2.Web -c Release -r win-arm64 --self-contained true -p:PlaywrightPlatform=win -o /build/web-win-arm64 \
&& dotnet publish OpenBullet2.Web -c Release -r osx-x64 --self-contained true -p:PlaywrightPlatform=osx -o /build/web-osx-x64 \
&& dotnet publish OpenBullet2.Web -c Release -r osx-arm64 --self-contained true -p:PlaywrightPlatform=all -o /build/web-osx-arm64 \
&& dotnet publish OpenBullet2.Web -c Release -r linux-x64 --self-contained true -p:PlaywrightPlatform=linux-x64 -o /build/web-linux-x64 \
&& dotnet publish OpenBullet2.Web -c Release -r linux-arm64 --self-contained true -p:PlaywrightPlatform=linux-arm64 -o /build/web-linux-arm64 \
&& find /build/web-win-x64 -name "*.xml" -type f -delete \
&& find /build/web-win-arm64 -name "*.xml" -type f -delete \
&& find /build/web-osx-x64 -name "*.xml" -type f -delete \
&& find /build/web-osx-arm64 -name "*.xml" -type f -delete \
&& find /build/web-linux-x64 -name "*.xml" -type f -delete \
&& find /build/web-linux-arm64 -name "*.xml" -type f -delete \
&& find /build/native-win-x64 -name "*.xml" -type f -delete \
&& find /build/native-win-arm64 -name "*.xml" -type f -delete \
&& rm -rf /build/web-osx-arm64/.playwright/node/darwin-x64 \
/build/web-osx-arm64/.playwright/node/linux-arm64 \
/build/web-osx-arm64/.playwright/node/linux-x64 \
/build/web-osx-arm64/.playwright/node/win32_x64 \
/tmp/openbullet2-curl-impersonate \
/root/.nuget/packages \
&& find /code -type d \( -name bin -o -name obj \) -prune -exec rm -rf {} +
# Manually copy over the dbip-country-lite.mmdb file from /code to /build
# since for some reason it doesn't get copied over by the dotnet publish command
RUN cp /code/OpenBullet2.Web/dbip-country-lite.mmdb /build
# --------
# FRONTEND
# --------
FROM node:20.9.0 AS frontend
WORKDIR /code
COPY openbullet2-web-client/package.json .
COPY openbullet2-web-client/package-lock.json .
RUN npm ci --no-audit --no-fund
COPY openbullet2-web-client .
RUN npm run build
RUN mkdir /build && mv dist/* /build
# ---------
# AGGREGATE
# ---------
FROM alpine:3.20
WORKDIR /app/web-win-x64
COPY --from=backend /build/web-win-x64 .
COPY --from=frontend /build ./wwwroot
COPY OpenBullet2.Web/dbip-country-lite.mmdb .
RUN ls -1A > build-files.txt
WORKDIR /app/web-linux-x64
COPY --from=backend /build/web-linux-x64 .
COPY --from=frontend /build ./wwwroot
COPY OpenBullet2.Web/dbip-country-lite.mmdb .
RUN ls -1A > build-files.txt
WORKDIR /app/web-win-arm64
COPY --from=backend /build/web-win-arm64 .
COPY --from=frontend /build ./wwwroot
COPY OpenBullet2.Web/dbip-country-lite.mmdb .
RUN ls -1A > build-files.txt
WORKDIR /app/web-osx-x64
COPY --from=backend /build/web-osx-x64 .
COPY --from=frontend /build ./wwwroot
COPY OpenBullet2.Web/dbip-country-lite.mmdb .
RUN ls -1A > build-files.txt
WORKDIR /app/web-osx-arm64
COPY --from=backend /build/web-osx-arm64 .
COPY --from=frontend /build ./wwwroot
COPY OpenBullet2.Web/dbip-country-lite.mmdb .
RUN ls -1A > build-files.txt
WORKDIR /app/web-linux-arm64
COPY --from=backend /build/web-linux-arm64 .
COPY --from=frontend /build ./wwwroot
COPY OpenBullet2.Web/dbip-country-lite.mmdb .
RUN ls -1A > build-files.txt
WORKDIR /app/native-win-x64
COPY --from=backend /build/native-win-x64 /app/native-win-x64
# Create a text file with all top-level files and folders, including hidden ones like .playwright,
# to be used by the updater
RUN ls -1A > build-files.txt
WORKDIR /app/native-win-arm64
COPY --from=backend /build/native-win-arm64 /app/native-win-arm64
# Create a text file with all top-level files and folders, including hidden ones like .playwright,
# to be used by the updater
RUN ls -1A > build-files.txt