forked from polterguy/magic
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker.backend
More file actions
68 lines (58 loc) · 3.01 KB
/
docker.backend
File metadata and controls
68 lines (58 loc) · 3.01 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
# Using .Net 9 image from Microsoft
FROM mcr.microsoft.com/dotnet/sdk:9.0 AS build
WORKDIR /app
# Copying projects
COPY /backend/ /backend/
COPY /plugins/ /plugins/
# Restoring and building projects
RUN dotnet restore /backend/backend.csproj
RUN dotnet publish /backend/backend.csproj -c release -o /magic
# Making sure we add all SQLite plugins to docker image
ADD /backend/sqlite-plugins/ /magic/sqlite-plugins/
# Final stage creating image
FROM mcr.microsoft.com/dotnet/aspnet:9.0
WORKDIR /magic
COPY --from=build /magic ./
# Getting some default fonts
RUN echo "deb http://deb.debian.org/debian/ bookworm main contrib" > /etc/apt/sources.list && \
echo "deb-src http://deb.debian.org/debian/ bookworm main contrib" >> /etc/apt/sources.list && \
echo "deb http://security.debian.org/ bookworm-security main contrib" >> /etc/apt/sources.list && \
echo "deb-src http://security.debian.org/ bookworm-security main contrib" >> /etc/apt/sources.list
RUN sed -i'.bak' 's/$/ contrib/' /etc/apt/sources.list
RUN apt-get update && apt-get install -y ttf-mscorefonts-installer fontconfig
RUN fc-cache -f -v
RUN apt-get install -y libgomp1 libatlas-base-dev liblapack-dev
# Repos + packages you already had
RUN echo "deb http://deb.debian.org/debian/ bookworm main contrib" > /etc/apt/sources.list && \
echo "deb-src http://deb.debian.org/debian/ bookworm main contrib" >> /etc/apt/sources.list && \
echo "deb http://security.debian.org/ bookworm-security main contrib" >> /etc/apt/sources.list && \
echo "deb-src http://security.debian.org/ bookworm-security main contrib" >> /etc/apt/sources.list && \
sed -i'.bak' 's/$/ contrib/' /etc/apt/sources.list && \
apt-get update && \
# ✨ KEY: system SQLite (has ENABLE_LOAD_EXTENSION)
apt-get install -y --no-install-recommends libsqlite3-0 \
# your existing deps
ttf-mscorefonts-installer fontconfig libgomp1 libatlas-base-dev liblapack-dev && \
fc-cache -f -v && \
rm -rf /var/lib/apt/lists/*
ENV LD_LIBRARY_PATH="/magic/sqlite-plugins:${LD_LIBRARY_PATH}"
RUN apt-get update && apt-get install -y --no-install-recommends libsqlite3-0 \
ttf-mscorefonts-installer fontconfig libgomp1 libatlas-base-dev liblapack-dev && \
ln -s /usr/lib/x86_64-linux-gnu/libsqlite3.so.0 /usr/lib/x86_64-linux-gnu/libsqlite3.so && \
fc-cache -f -v && \
rm -rf /var/lib/apt/lists/*
RUN apt-get update && apt-get install -y --no-install-recommends \
libsqlite3-0 libsqlite3-dev libstdc++6 libgcc-s1 \
ttf-mscorefonts-installer fontconfig libgomp1 libatlas-base-dev liblapack-dev && \
fc-cache -f -v && \
rm -rf /var/lib/apt/lists/*
# TODO: Commented out!
# This doesn't work. I suspect the reason is that it's dynamically loading the SQLite DLL or something ...?
# Making sure we run in the context of a custom user with restricted access to core operating system
# RUN groupadd -r magic && useradd -g magic magic
# RUN chown -R magic:magic /magic
# USER magic
# Our entry point
EXPOSE 4444
ENV ASPNETCORE_URLS="http://+:4444"
ENTRYPOINT ["dotnet", "backend.dll"]