Add docker and pipeline
This commit is contained in:
parent
77fd12a796
commit
90bcd867b0
3 changed files with 53 additions and 2 deletions
|
@ -1,9 +1,25 @@
|
||||||
steps:
|
steps:
|
||||||
- name: Tests
|
- name: Tests
|
||||||
when:
|
when:
|
||||||
- branch: main
|
- branch: [main,dev]
|
||||||
event: push
|
event: push
|
||||||
- event: tag
|
- event: [pull_request, pull_request_closed, tag]
|
||||||
image: mcr.microsoft.com/dotnet/sdk:8.0
|
image: mcr.microsoft.com/dotnet/sdk:8.0
|
||||||
commands:
|
commands:
|
||||||
- dotnet test
|
- dotnet test
|
||||||
|
|
||||||
|
- name: Build and Publish Dev Docker Image
|
||||||
|
when:
|
||||||
|
- branch: dev
|
||||||
|
image: woodpeckerci/plugin-docker-buildx:4.2
|
||||||
|
settings:
|
||||||
|
platforms: linux/amd64,linux/arm64
|
||||||
|
repo: ${CI_REG_HOST}:${CI_REG_PORT}/${CI_REPO_OWNER}/${CI_REPO_NAME}
|
||||||
|
tags: dev
|
||||||
|
registry: http://${CI_REG_HOST}:${CI_REG_PORT}
|
||||||
|
insecure: true
|
||||||
|
buildkit_config: "[registry.\"${CI_REG_HOST}:${CI_REG_PORT}\"]\n http = true\n insecure = true"
|
||||||
|
username:
|
||||||
|
from_secret: CI_REG_USER
|
||||||
|
password:
|
||||||
|
from_secret: CI_REG_TOKEN
|
||||||
|
|
|
@ -13,6 +13,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution", "Solution", "{EB
|
||||||
Alveus.ruleset = Alveus.ruleset
|
Alveus.ruleset = Alveus.ruleset
|
||||||
LICENSE = LICENSE
|
LICENSE = LICENSE
|
||||||
README.md = README.md
|
README.md = README.md
|
||||||
|
.woodpecker.yml = .woodpecker.yml
|
||||||
|
Dockerfile = Dockerfile
|
||||||
EndProjectSection
|
EndProjectSection
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Astral.Tests", "Astral.Tests\Astral.Tests.csproj", "{F0CBECAA-F279-4D94-9F83-E9EBC7A5C08C}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Astral.Tests", "Astral.Tests\Astral.Tests.csproj", "{F0CBECAA-F279-4D94-9F83-E9EBC7A5C08C}"
|
||||||
|
|
33
Dockerfile
Normal file
33
Dockerfile
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base
|
||||||
|
USER $APP_UID
|
||||||
|
WORKDIR /app
|
||||||
|
EXPOSE 8080
|
||||||
|
EXPOSE 8081
|
||||||
|
|
||||||
|
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:8.0 AS build
|
||||||
|
ARG TARGETARCH
|
||||||
|
ARG BUILDPLATFORM
|
||||||
|
ARG BUILD_CONFIGURATION=Release
|
||||||
|
|
||||||
|
WORKDIR /src
|
||||||
|
|
||||||
|
COPY ["Astral.ApiServer/Astral.ApiServer.csproj", "Astral.ApiServer/"]
|
||||||
|
COPY ["Astral.Core/Astral.Core.csproj", "Astral.Core/"]
|
||||||
|
COPY ["Astral.Services/Astral.Services.csproj", "Astral.Services/"]
|
||||||
|
COPY ["Astral.DAL/Astral.DAL.csproj", "Astral.DAL/"]
|
||||||
|
|
||||||
|
RUN dotnet restore "Astral.ApiServer/Astral.ApiServer.csproj"
|
||||||
|
COPY . .
|
||||||
|
WORKDIR "/src/Astral.ApiServer"
|
||||||
|
RUN dotnet build "Astral.ApiServer.csproj" -c $BUILD_CONFIGURATION -a $TARGETARCH -o /app/build
|
||||||
|
|
||||||
|
FROM build AS publish
|
||||||
|
ARG TARGETARCH
|
||||||
|
ARG BUILD_CONFIGURATION=Release
|
||||||
|
|
||||||
|
RUN dotnet publish "Astral.ApiServer.csproj" --no-restore -c $BUILD_CONFIGURATION -a $TARGETARCH -o /app/publish /p:UseAppHost=false
|
||||||
|
|
||||||
|
FROM base AS final
|
||||||
|
WORKDIR /app
|
||||||
|
COPY --from=publish /app/publish .
|
||||||
|
ENTRYPOINT ["dotnet", "Astral.ApiServer.dll"]
|
Loading…
Reference in a new issue