-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathDockerfile
More file actions
43 lines (37 loc) · 1.38 KB
/
Dockerfile
File metadata and controls
43 lines (37 loc) · 1.38 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
# https://hub.docker.com/_/microsoft-dotnet
FROM mcr.microsoft.com/dotnet/sdk:10.0 AS build
ARG VERSION=0.0.0-dev
WORKDIR /source
# copy csproj and restore as distinct layers
COPY *.slnx .
COPY Directory.Build.props .
COPY SAMA.Web/*.csproj SAMA.Web/
COPY SAMA.Data/*.csproj SAMA.Data/
COPY SAMA.Shared/*.csproj SAMA.Shared/
COPY SAMA.Tests.Unit/*.csproj SAMA.Tests.Unit/
COPY SAMA.Tests.Integration/*.csproj SAMA.Tests.Integration/
COPY SAMA.Tests.System/*.csproj SAMA.Tests.System/
RUN dotnet restore SAMA.slnx
# copy everything else and build app
COPY . .
WORKDIR /source/SAMA.Web
RUN dotnet publish -c release -o /app --no-restore /p:MinVerSkip=true /p:Version=${VERSION}
# final stage/image
FROM mcr.microsoft.com/dotnet/aspnet:10.0
RUN apt-get update \
&& apt-get install -y iputils-ping tini curl python3-venv python3-pip \
&& apt-get clean
ARG VERSION=0.0.0-dev
WORKDIR /app
COPY --from=build /app ./
# create keys directory with proper permissions
RUN mkdir -p /app/keys && chown -R app:app /app/keys
LABEL org.opencontainers.image.title="SAMA"
LABEL org.opencontainers.image.description="Service Availability Monitoring and Alerting"
LABEL org.opencontainers.image.version="${VERSION}"
LABEL org.opencontainers.image.source="https://github.com/sep/sama"
# Run as non-root user (built into the base image)
USER app
VOLUME ["/app/keys"]
EXPOSE 8080
ENTRYPOINT ["tini", "--", "dotnet", "SAMA.Web.dll"]