-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathDockerfile.sudo
More file actions
45 lines (39 loc) · 1.54 KB
/
Dockerfile.sudo
File metadata and controls
45 lines (39 loc) · 1.54 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
44
45
# https://hub.docker.com/_/microsoft-dotnet
# Sudo-enabled variant - runs as root, drops to app user
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 sudo \
&& apt-get clean
ARG VERSION=0.0.0-dev
WORKDIR /app
COPY --from=build /app ./
COPY docker-entrypoint-sudo.sh /app/docker-entrypoint.sh
RUN chmod +x /app/docker-entrypoint.sh
# 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 (sudo-enabled)"
LABEL org.opencontainers.image.version="${VERSION}"
LABEL org.opencontainers.image.source="https://github.com/sep/sama"
# Run as root - entrypoint will drop to app user
VOLUME ["/app/keys"]
EXPOSE 8080
ENTRYPOINT ["tini", "--", "/app/docker-entrypoint.sh"]