Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ci #15

Merged
merged 2 commits into from
Jan 24, 2024
Merged

Ci #15

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
**/.dockerignore
**/.env
**/.git
**/.gitignore
**/.project
**/.settings
**/.toolstarget
**/.vs
**/.vscode
**/.idea
**/*.*proj.user
**/*.dbmdl
**/*.jfm
**/azds.yaml
**/bin
**/charts
**/docker-compose*
**/Dockerfile*
**/node_modules
**/npm-debug.log
**/obj
**/secrets.dev.yaml
**/values.dev.yaml
LICENSE
README.md
15 changes: 10 additions & 5 deletions .github/workflows/publish-images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ name: Publish docker images

on:
push:
branches: [ "release" ]
pull_request:
branches: [ "release" ]
tags: [ "v*" ]

env:
IMAGE_NAME: ${{ secrets.REGISTRY }}/${{ github.action_repository }}/domus-api

jobs:
publish:
Expand All @@ -24,8 +25,12 @@ jobs:
- name: Build projects
run: dotnet build -c Release

- name: Get version
id: version
uses: battila7/get-version-action@v2

- name: Build docker images
run: docker build -f file_location -t image_name .
run: docker build -f Domus.Api/Dockerfile -t ${{ IMAGE_NAME }}:${{ steps.version.outputs.version-without-v }} .

- name: Publish images
run: docker push image_name
run: docker push ${{ IMAGE_NAME }}:${{ steps.version.outputs.version-without-v }}
20 changes: 20 additions & 0 deletions Domus.Api/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
FROM mcr.microsoft.com/dotnet/aspnet:7.0 AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443

FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build
WORKDIR /src
COPY ["Domus.Api/Domus.Api.csproj", "Domus.Api/"]
RUN dotnet restore "Domus.Api/Domus.Api.csproj"
COPY . .
WORKDIR "/src/Domus.Api"
RUN dotnet build "Domus.Api.csproj" -c Release -o /app/build

FROM build AS publish
RUN dotnet publish "Domus.Api.csproj" -c Release -o /app/publish /p:UseAppHost=false

FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "Domus.Api.dll"]
Loading