-
Notifications
You must be signed in to change notification settings - Fork 25
/
HttpsProxy.Dockerfile
42 lines (30 loc) · 1.07 KB
/
HttpsProxy.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
# Build stage
FROM mcr.microsoft.com/dotnet/sdk:8.0.401-1-alpine3.20 AS build
WORKDIR /build
COPY *.sln ./
COPY **/*.csproj ./
RUN dotnet sln list | grep ".csproj" \
| while read -r line; do \
mkdir -p $(dirname $line); \
mv $(basename $line) $(dirname $line); \
done;
RUN dotnet restore --use-current-runtime
COPY . .
RUN dotnet publish Refresh.HttpsProxy -c Release --property:OutputPath=/build/publish/ --no-restore --no-self-contained
# Final running container
FROM mcr.microsoft.com/dotnet/runtime:8.0.8-alpine3.20 AS final
# Add non-root user
RUN set -eux && \
apk add --no-cache su-exec && \
su-exec nobody true && \
addgroup -g 1001 refresh && \
adduser -D -h /refresh -u 1001 -G refresh refresh && \
mkdir -p /refresh/data && \
mkdir -p /refresh/app
COPY --from=build /build/publish/publish /refresh/app
COPY --from=build /build/scripts/docker-entrypoint.sh /refresh
RUN chown -R refresh:refresh /refresh && \
chmod +x /refresh/docker-entrypoint.sh
ENV PRIV_CMD su-exec
ENV PRIV_USER refresh:refresh
ENTRYPOINT ["/refresh/docker-entrypoint.sh", "HttpsProxy"]