Skip to content

Commit

Permalink
⭐ Update GA
Browse files Browse the repository at this point in the history
  • Loading branch information
ntxinh committed Oct 29, 2023
1 parent 68d4492 commit fdf970f
Show file tree
Hide file tree
Showing 5 changed files with 100 additions and 2 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/container.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Publish container

on:
# Runs on pushes targeting the default branch
push:
branches: ["main"]
tags:
- "v*.*.*"

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

jobs:
login:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v3

- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build the Docker image
run: |
docker build . --tag ghcr.io/ntxinh/AspNetCore-DDD:latest
docker push ghcr.io/ntxinh/AspNetCore-DDD:latest
16 changes: 16 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Release

on:
push:
branches: ["main"]
tags:
- "v*.*.*"

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Release
uses: softprops/action-gh-release@v1
40 changes: 40 additions & 0 deletions Containerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# .NET Core SDK
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build

# Sets the working directory
WORKDIR /app

# Copy Projects
#COPY *.sln .
COPY Src/DDD.Application/DDD.Application.csproj ./Src/DDD.Application/
COPY Src/DDD.Domain/DDD.Domain.csproj ./Src/DDD.Domain/
COPY Src/DDD.Domain.Core/DDD.Domain.Core.csproj ./Src/DDD.Domain.Core/
COPY Src/DDD.Infra.CrossCutting.Bus/DDD.Infra.CrossCutting.Bus.csproj ./Src/DDD.Infra.CrossCutting.Bus/
COPY Src/DDD.Infra.CrossCutting.Identity/DDD.Infra.CrossCutting.Identity.csproj ./Src/DDD.Infra.CrossCutting.Identity/
COPY Src/DDD.Infra.CrossCutting.IoC/DDD.Infra.CrossCutting.IoC.csproj ./Src/DDD.Infra.CrossCutting.IoC/
COPY Src/DDD.Infra.Data/DDD.Infra.Data.csproj ./Src/DDD.Infra.Data/
COPY Src/DDD.Services.Api/DDD.Services.Api.csproj ./Src/DDD.Services.Api/

# .NET Core Restore
RUN dotnet restore ./Src/DDD.Services.Api/DDD.Services.Api.csproj

# Copy All Files
COPY Src ./Src

# .NET Core Build and Publish
RUN dotnet publish ./Src/DDD.Services.Api/DDD.Services.Api.csproj -c Release -o /publish

# ASP.NET Core Runtime
FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS runtime
WORKDIR /app
COPY --from=build /publish ./

# Expose ports
EXPOSE 80
EXPOSE 443

# Setup your variables before running.
ARG MyEnv
ENV ASPNETCORE_ENVIRONMENT $MyEnv

ENTRYPOINT ["dotnet", "DDD.Services.Api.dll"]
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# .NET Core SDK
FROM mcr.microsoft.com/dotnet/core/sdk:6.0-alpine AS build
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build

# Sets the working directory
WORKDIR /app
Expand All @@ -25,7 +25,7 @@ COPY Src ./Src
RUN dotnet publish ./Src/DDD.Services.Api/DDD.Services.Api.csproj -c Release -o /publish

# ASP.NET Core Runtime
FROM mcr.microsoft.com/dotnet/core/aspnet:6.0-alpine AS runtime
FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS runtime
WORKDIR /app
COPY --from=build /publish ./

Expand Down
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,16 @@ docker run -d -p 3000:80 --name aspnetcore-docker-container aspnetcore-docker-im

- http://localhost:3000/

# Podman

```bash
podman build -t aspnetcore-docker-image .
podman run -it --rm -p 3000:80 --name aspnetcore-docker-container aspnetcore-docker-image
podman run -d -p 3000:80 --name aspnetcore-docker-container aspnetcore-docker-image
```

- http://localhost:3000/

# Swagger (Dev env only)
- http://localhost:5000/swagger

Expand Down

0 comments on commit fdf970f

Please sign in to comment.