-
Notifications
You must be signed in to change notification settings - Fork 504
/
Copy pathDockerfile.build
77 lines (56 loc) · 2.7 KB
/
Dockerfile.build
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
# This Dockerfile is meant to be run in a CI/CD pipeline to build the OpenBullet2 project.
# -------
# BACKEND
# -------
FROM mcr.microsoft.com/dotnet/sdk:8.0-bookworm-slim AS backend
WORKDIR /code
COPY . .
RUN dotnet publish OpenBullet2.Native -c Release -r win-x64 -o /build/native
RUN dotnet publish OpenBullet2.Web -c Release -o /build/web
RUN dotnet publish OpenBullet2.Web -c Release -r win-x64 -o /build/web-win-x64
RUN dotnet publish OpenBullet2.Web.Updater -c Release -r win-x64 -o /updater/web/win-x64
RUN dotnet publish OpenBullet2.Web.Updater -c Release -r win-x86 -o /updater/web/win-x86
RUN dotnet publish OpenBullet2.Web.Updater -c Release -r win-arm64 -o /updater/web/win-arm64
RUN dotnet publish OpenBullet2.Web.Updater -c Release -r linux-x64 -o /updater/web/linux-x64
RUN dotnet publish OpenBullet2.Web.Updater -c Release -r linux-arm64 -o /updater/web/linux-arm64
RUN dotnet publish OpenBullet2.Native.Updater -c Release -r win-x64 -o /updater/native/win-x64
RUN dotnet publish OpenBullet2.Native.Updater -c Release -r win-x86 -o /updater/native/win-x86
RUN dotnet publish OpenBullet2.Native.Updater -c Release -r win-arm64 -o /updater/native/win-arm64
# No osx because it needs codesign and it costs money...
# Copy the win-x64 executable to the root of the web folder
RUN cp /build/web-win-x64/OpenBullet2.Web.exe /build/web/OpenBullet2.Web.exe
WORKDIR /build/web
# Remove all .xml files
# (we cannot use <GenerateDocumentationFile>false</GenerateDocumentationFile>
# because we need it for swagger)
RUN find . -name "*.xml" -type f -delete
# 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 install
COPY openbullet2-web-client .
RUN npm run build
RUN mkdir /build && mv dist/* /build
# ---------
# AGGREGATE
# ---------
FROM mcr.microsoft.com/dotnet/aspnet:8.0-bookworm-slim
RUN apt-get update -yq && apt-get install -y --no-install-recommends curl
WORKDIR /app/web
COPY --from=backend /build/web .
COPY --from=frontend /build ./wwwroot
COPY OpenBullet2.Web/dbip-country-lite.mmdb .
# Create a text file with all the files and folders in the current directory, not recursive, to be used by the updater
RUN ls -1 > build-files.txt
WORKDIR /app/native
COPY --from=backend /build/native /app/native
# Create a text file with all the files and folders in the current directory, not recursive, to be used by the updater
RUN ls -1 > build-files.txt
COPY --from=backend /updater /app/updater