forked from retaildevcrews/ngsa-app
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
36 lines (25 loc) · 772 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
### Build and Test the App
#checkov:skip=CKV_DOCKER_2: No healthcheck is needed
FROM mcr.microsoft.com/dotnet/sdk:6.0-alpine AS build
### copy the source and tests
COPY . /src
WORKDIR /src
# build the app
RUN dotnet publish -c Release -o /app
###########################################################
### Build the runtime container
FROM mcr.microsoft.com/dotnet/aspnet:6.0-alpine AS release
### if port is changed, also update value in Config
EXPOSE 8080
WORKDIR /app
### create a user
### dotnet needs a home directory
RUN addgroup -S ngsa && \
adduser -S ngsa -G ngsa && \
mkdir -p /home/ngsa && \
chown -R ngsa:ngsa /home/ngsa
### run as ngsa user
USER ngsa
### copy the app
COPY --from=build /app .
ENTRYPOINT [ "dotnet", "aspnetapp.dll" ]