-
Notifications
You must be signed in to change notification settings - Fork 2k
Expand file tree
/
Copy pathDockerfile
More file actions
59 lines (51 loc) · 1.6 KB
/
Copy pathDockerfile
File metadata and controls
59 lines (51 loc) · 1.6 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
# Installer image
FROM mcr.microsoft.com/cbl-mariner/base/core:2.0 AS installer
# Install .NET's dependencies into a staging location
RUN mkdir /staging \
&& tdnf install -y --releasever=2.0 --installroot /staging \
prebuilt-ca-certificates \
\
# .NET dependencies
glibc \
krb5 \
libgcc \
libstdc++ \
openssl-libs \
zlib \
&& tdnf clean all
# Create a non-root user and group
RUN tdnf install -y shadow-utils \
&& tdnf clean all \
&& groupadd \
--system \
--gid=101 \
app \
&& adduser \
--uid 101 \
--gid app \
--shell /bin/false \
--no-create-home \
--system \
app \
# Copy user/group info to staging
&& cp /etc/passwd /staging/etc/passwd \
&& cp /etc/group /staging/etc/group
# Clean up staging
RUN rm -rf /staging/etc/tdnf \
&& rm -rf /staging/run/* \
&& rm -rf /staging/var/cache/tdnf \
&& rm -rf /staging/var/lib/rpm \
&& rm -rf /staging/usr/share/doc \
&& rm -rf /staging/usr/share/man \
&& find /staging/var/log -type f -size +0 -delete
# .NET runtime-deps image
FROM mcr.microsoft.com/cbl-mariner/distroless/minimal:2.0
COPY --from=installer /staging/ /
ENV \
# Configure web servers to bind to port 8080 when present
ASPNETCORE_URLS=http://+:8080 \
# Enable detection of running in a container
DOTNET_RUNNING_IN_CONTAINER=true \
# Set the invariant mode since ICU package isn't included (see https://github.com/dotnet/announcements/issues/20)
DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=true
USER app