File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ name : Publish container
2+
3+ on :
4+ # Runs on pushes targeting the default branch
5+ push :
6+ branches : ["main"]
7+ tags :
8+ - " v*.*.*"
9+
10+ # Allows you to run this workflow manually from the Actions tab
11+ workflow_dispatch :
12+
13+ jobs :
14+ login :
15+ runs-on : ubuntu-latest
16+ permissions :
17+ contents : read
18+ packages : write
19+ steps :
20+ - uses : actions/checkout@v3
21+
22+ - name : Login to GitHub Container Registry
23+ uses : docker/login-action@v3
24+ with :
25+ registry : ghcr.io
26+ username : ${{ github.actor }}
27+ password : ${{ secrets.GITHUB_TOKEN }}
28+
29+ - name : Build the Docker image
30+ run : |
31+ docker build . --tag ghcr.io/ntxinh/AspNetCore-DDD:latest
32+ docker push ghcr.io/ntxinh/AspNetCore-DDD:latest
Original file line number Diff line number Diff line change 1+ name : Release
2+
3+ on :
4+ push :
5+ branches : ["main"]
6+ tags :
7+ - " v*.*.*"
8+
9+ jobs :
10+ build :
11+ runs-on : ubuntu-latest
12+ steps :
13+ - name : Checkout
14+ uses : actions/checkout@v3
15+ - name : Release
16+ uses : softprops/action-gh-release@v1
Original file line number Diff line number Diff line change 1+ # .NET Core SDK
2+ FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
3+
4+ # Sets the working directory
5+ WORKDIR /app
6+
7+ # Copy Projects
8+ # COPY *.sln .
9+ COPY Src/DDD.Application/DDD.Application.csproj ./Src/DDD.Application/
10+ COPY Src/DDD.Domain/DDD.Domain.csproj ./Src/DDD.Domain/
11+ COPY Src/DDD.Domain.Core/DDD.Domain.Core.csproj ./Src/DDD.Domain.Core/
12+ COPY Src/DDD.Infra.CrossCutting.Bus/DDD.Infra.CrossCutting.Bus.csproj ./Src/DDD.Infra.CrossCutting.Bus/
13+ COPY Src/DDD.Infra.CrossCutting.Identity/DDD.Infra.CrossCutting.Identity.csproj ./Src/DDD.Infra.CrossCutting.Identity/
14+ COPY Src/DDD.Infra.CrossCutting.IoC/DDD.Infra.CrossCutting.IoC.csproj ./Src/DDD.Infra.CrossCutting.IoC/
15+ COPY Src/DDD.Infra.Data/DDD.Infra.Data.csproj ./Src/DDD.Infra.Data/
16+ COPY Src/DDD.Services.Api/DDD.Services.Api.csproj ./Src/DDD.Services.Api/
17+
18+ # .NET Core Restore
19+ RUN dotnet restore ./Src/DDD.Services.Api/DDD.Services.Api.csproj
20+
21+ # Copy All Files
22+ COPY Src ./Src
23+
24+ # .NET Core Build and Publish
25+ RUN dotnet publish ./Src/DDD.Services.Api/DDD.Services.Api.csproj -c Release -o /publish
26+
27+ # ASP.NET Core Runtime
28+ FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS runtime
29+ WORKDIR /app
30+ COPY --from=build /publish ./
31+
32+ # Expose ports
33+ EXPOSE 80
34+ EXPOSE 443
35+
36+ # Setup your variables before running.
37+ ARG MyEnv
38+ ENV ASPNETCORE_ENVIRONMENT $MyEnv
39+
40+ ENTRYPOINT ["dotnet" , "DDD.Services.Api.dll" ]
Original file line number Diff line number Diff line change 11# .NET Core SDK
2- FROM mcr.microsoft.com/dotnet/core/ sdk:6.0-alpine AS build
2+ FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
33
44# Sets the working directory
55WORKDIR /app
@@ -25,7 +25,7 @@ COPY Src ./Src
2525RUN dotnet publish ./Src/DDD.Services.Api/DDD.Services.Api.csproj -c Release -o /publish
2626
2727# ASP.NET Core Runtime
28- FROM mcr.microsoft.com/dotnet/core/ aspnet:6.0-alpine AS runtime
28+ FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS runtime
2929WORKDIR /app
3030COPY --from=build /publish ./
3131
Original file line number Diff line number Diff line change @@ -85,6 +85,16 @@ docker run -d -p 3000:80 --name aspnetcore-docker-container aspnetcore-docker-im
8585
8686- http://localhost:3000/
8787
88+ # Podman
89+
90+ ``` bash
91+ podman build -t aspnetcore-docker-image .
92+ podman run -it --rm -p 3000:80 --name aspnetcore-docker-container aspnetcore-docker-image
93+ podman run -d -p 3000:80 --name aspnetcore-docker-container aspnetcore-docker-image
94+ ```
95+
96+ - http://localhost:3000/
97+
8898# Swagger (Dev env only)
8999- http://localhost:5000/swagger
90100
You can’t perform that action at this time.
0 commit comments