forked from openbullet/OpenBullet2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
69 lines (50 loc) · 2.02 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
62
63
64
65
66
67
68
69
# This Dockerfile is meant to be run locally to build the OpenBullet2 project
# for normal usage via docker.
# -------
# BACKEND
# -------
FROM mcr.microsoft.com/dotnet/sdk:8.0-bookworm-slim AS backend
WORKDIR /code
COPY . .
RUN dotnet publish OpenBullet2.Web -c Release -o /build/web
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
ENV DEBIAN_FRONTEND=noninteractive
WORKDIR /app
COPY --from=backend /build/web .
COPY --from=frontend /build ./wwwroot
COPY OpenBullet2.Web/dbip-country-lite.mmdb .
# Install dependencies
RUN apt-get update -yq && apt-get install -y --no-install-recommends apt-utils
RUN apt-get upgrade -yq && apt-get install -yq apt-utils curl git nano wget unzip python3 python3-pip
# Setup nodejs
RUN curl -sL https://deb.nodesource.com/setup_current.x | bash - && apt-get install -yq nodejs build-essential
RUN echo "deb http://deb.debian.org/debian/ unstable main contrib non-free" >> /etc/apt/sources.list.d/debian.list
# Install chromium and firefox for selenium and puppeteer
RUN apt-get update -yq && apt-get install -y --no-install-recommends firefox chromium
RUN pip3 install webdrivermanager || true
RUN webdrivermanager firefox chrome --linkpath /usr/local/bin || true
RUN apt-get clean && rm -rf /var/lib/apt/lists/*
EXPOSE 5000
CMD ["dotnet", "./OpenBullet2.Web.dll", "--urls=http://*:5000"]