forked from Xenomega/EchoRelay
-
Notifications
You must be signed in to change notification settings - Fork 14
/
Dockerfile
42 lines (30 loc) · 960 Bytes
/
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
# syntax=docker/dockerfile:1
# Taken from https://learn.microsoft.com/en-us/dotnet/core/docker/build-container
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:7.0 AS build
LABEL org.opencontainers.image.authors="github:EchoTools"
ARG BUILD_CONFIG="Release"
COPY . /source
WORKDIR /source
# Leverage cache
RUN --mount=type=cache,id=nuget,target=./nuget-packages \
dotnet publish EchoRelay.Cli \
--configuration ${BUILD_CONFIG} \
--use-current-runtime --self-contained false -o /app
FROM mcr.microsoft.com/dotnet/aspnet:7.0-alpine AS final
WORKDIR /app
COPY --from=build /app .
# Run the app using an non-privileged user
ARG UID=10001
RUN adduser \
--disabled-password \
--gecos "" \
--home "/nonexistent" \
--shell "/sbin/nologin" \
--no-create-home \
--uid "${UID}" \
appuser
RUN mkdir /data && chown 10001 /data
USER appuser
WORKDIR /app
VOLUME /data
ENTRYPOINT ["dotnet", "EchoRelay.Cli.dll"]