-
-
Notifications
You must be signed in to change notification settings - Fork 25
/
Dockerfile
34 lines (30 loc) · 1.03 KB
/
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
FROM --platform=${BUILDPLATFORM} \
mcr.microsoft.com/dotnet/sdk:8.0.403 AS build-env
WORKDIR /app
# Copy csproj and restore as distinct layers
COPY *.csproj ./
RUN dotnet restore
# Copy source code and build
COPY . ./
RUN dotnet build -c Release -o out
# We already have this image pulled, its actually quicker to reuse it
FROM mcr.microsoft.com/dotnet/sdk:8.0.403 AS git-collector
WORKDIR /out
COPY . .
RUN touch dummy.txt && \
if [ -d .git ]; then \
git rev-parse --short HEAD > CommitHash.txt && \
git log --pretty=format:"%s" -n 1 > CommitMessage.txt && \
git log --pretty=format:"%ci" -n 1 > CommitTime.txt; \
fi
# Build runtime image
FROM mcr.microsoft.com/dotnet/runtime:8.0.10-alpine3.20
LABEL com.centurylinklabs.watchtower.enable=true
WORKDIR /app
RUN apk add --no-cache git redis openssh
RUN git config --global --add safe.directory /app/Lists/Private
COPY --from=build-env /app/out .
ADD Lists ./Lists
ADD config.json ./
COPY --from=git-collector /out/*.txt ./
ENTRYPOINT ["dotnet", "Cliptok.dll"]