-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathDockerfile
43 lines (31 loc) · 903 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
43
### build the app
FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build
# Copy the source
COPY src /src
### Run the unit tests
WORKDIR /src/tests
RUN dotnet test
### Build the release app
WORKDIR /src/app
RUN dotnet publish -c Release -o /app
###########################################################
### build the runtime container
FROM mcr.microsoft.com/dotnet/aspnet:7.0-alpine AS runtime
### create a user
### dotnet needs a home directory
RUN addgroup -S webv && \
adduser -S webv -G webv && \
mkdir -p /home/webv && \
chown -R webv:webv /home/webv
WORKDIR /app
COPY --from=build /app .
RUN mkdir -p /app/TestFiles && \
cp *.json TestFiles && \
cp perfTargets.txt TestFiles && \
rm -f appsettings.json && \
rm -f stylecop.json && \
chown -R webv:webv /app
WORKDIR /app/TestFiles
# run as the webv user
USER webv
ENTRYPOINT [ "dotnet", "../webvalidate.dll" ]