build: update dockerfile
This commit is contained in:
7
.github/workflows/deploy.yml
vendored
7
.github/workflows/deploy.yml
vendored
@@ -42,7 +42,12 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
IMAGE="${{ secrets.WINSOMNIA_REGISTRY }}/winsomnia/${{ steps.envdetect.outputs.repo_slug }}:${GITHUB_REF_NAME}"
|
IMAGE="${{ secrets.WINSOMNIA_REGISTRY }}/winsomnia/${{ steps.envdetect.outputs.repo_slug }}:${GITHUB_REF_NAME}"
|
||||||
|
|
||||||
docker build -t "$IMAGE" .
|
docker build \
|
||||||
|
--secret id=nuget_username,env=WINSOMNIA_NUGET_USERNAME \
|
||||||
|
--secret id=nuget_token,env=WINSOMNIA_NUGET_TOKEN \
|
||||||
|
--secret id=nuget_source,env=WINSOMNIA_NUGET_SOURCE \
|
||||||
|
-t "$IMAGE" .
|
||||||
|
|
||||||
docker push "$IMAGE"
|
docker push "$IMAGE"
|
||||||
|
|
||||||
echo "image=$IMAGE" >> $GITHUB_OUTPUT
|
echo "image=$IMAGE" >> $GITHUB_OUTPUT
|
||||||
|
|||||||
23
Dockerfile
23
Dockerfile
@@ -1,25 +1,27 @@
|
|||||||
FROM mcr.microsoft.com/dotnet/aspnet:10.0 AS base
|
FROM mcr.microsoft.com/dotnet/aspnet:10.0 AS base
|
||||||
LABEL company="Winsomnia"
|
LABEL company="Winsomnia"
|
||||||
LABEL maintainer.name="Wesser" maintainer.email="support@winsomnia.net"
|
LABEL maintainer.name="Wesser" maintainer.email="support@winsomnia.net"
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
RUN apt-get update && apt-get install -y curl && rm -rf /var/lib/apt/lists/*
|
RUN apt-get update && apt-get install -y curl && rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
|
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
|
||||||
CMD curl --fail http://localhost:8080/health || exit 1
|
CMD curl --fail http://localhost:8080/health || exit 1
|
||||||
|
|
||||||
FROM mcr.microsoft.com/dotnet/sdk:10.0 AS build
|
FROM mcr.microsoft.com/dotnet/sdk:10.0 AS build
|
||||||
|
|
||||||
WORKDIR /src
|
WORKDIR /src
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
ARG NUGET_USERNAME
|
RUN --mount=type=secret,id=nuget_username \
|
||||||
ARG NUGET_PASSWORD
|
--mount=type=secret,id=nuget_token \
|
||||||
ARG NUGET_ADDRESS
|
--mount=type=secret,id=nuget_source \
|
||||||
|
dotnet nuget add source $(cat /run/secrets/nuget_source) \
|
||||||
RUN dotnet nuget add source ${NUGET_ADDRESS} \
|
--name Winsomnia \
|
||||||
--name Winsomnia \
|
--username $(cat /run/secrets/nuget_username) \
|
||||||
--username ${NUGET_USERNAME} \
|
--password $(cat /run/secrets/nuget_token) \
|
||||||
--password ${NUGET_PASSWORD} \
|
--store-password-in-clear-text
|
||||||
--store-password-in-clear-text
|
|
||||||
|
|
||||||
RUN dotnet restore ./Backend.sln
|
RUN dotnet restore ./Backend.sln
|
||||||
|
|
||||||
@@ -31,6 +33,9 @@ RUN dotnet publish Endpoint/Endpoint.csproj \
|
|||||||
|
|
||||||
FROM base AS final
|
FROM base AS final
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
COPY --from=build /app .
|
COPY --from=build /app .
|
||||||
|
|
||||||
RUN find . -name "*.pdb" -type f -delete
|
RUN find . -name "*.pdb" -type f -delete
|
||||||
|
|
||||||
ENTRYPOINT ["dotnet", "Mirea.Api.Endpoint.dll"]
|
ENTRYPOINT ["dotnet", "Mirea.Api.Endpoint.dll"]
|
||||||
Reference in New Issue
Block a user