Added dockerfile.
This commit is contained in:
14
.dockerignore
Normal file
14
.dockerignore
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
**/bin/
|
||||||
|
**/obj/
|
||||||
|
**/.vs/
|
||||||
|
**/.vscode/
|
||||||
|
**/*.user
|
||||||
|
**/*.suo
|
||||||
|
**/*.csproj.user
|
||||||
|
**/node_modules/
|
||||||
|
.git
|
||||||
|
.gitignore
|
||||||
|
Dockerfile
|
||||||
|
docker-compose*.yml
|
||||||
|
TestResults/
|
||||||
|
.artifacts/
|
||||||
@@ -38,6 +38,8 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
REGISTRY: ${{ secrets.REGISTRY_HOST }}
|
REGISTRY: ${{ secrets.REGISTRY_HOST }}
|
||||||
OWNER_REPO: ${{ github.repository }}
|
OWNER_REPO: ${{ github.repository }}
|
||||||
|
DOCKERFILE: src/JSMR.Api/Dockerfile
|
||||||
|
CONTEXT: .
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
@@ -56,9 +58,9 @@ jobs:
|
|||||||
|
|
||||||
- name: Enable BuildKit
|
- name: Enable BuildKit
|
||||||
run: echo "DOCKER_BUILDKIT=1" >> $GITHUB_ENV
|
run: echo "DOCKER_BUILDKIT=1" >> $GITHUB_ENV
|
||||||
|
|
||||||
- name: Build
|
- name: Build
|
||||||
run: docker build -t "${{ steps.names.outputs.image }}:${{ github.sha }}" .
|
run: docker build -f "$DOCKERFILE" -t "${{ steps.names.outputs.image }}:${{ github.sha }}" "$CONTEXT"
|
||||||
|
|
||||||
- name: Push
|
- name: Push
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
24
JSMR.Api/Dockerfile
Normal file
24
JSMR.Api/Dockerfile
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
# --- Build stage ---
|
||||||
|
FROM mcr.microsoft.com/dotnet/sdk:9.0 AS build
|
||||||
|
WORKDIR /src
|
||||||
|
|
||||||
|
# copy solution + restore-friendly files first for better layer caching
|
||||||
|
COPY JSMR.sln ./
|
||||||
|
COPY src/JSMR.Api/JSMR.Api.csproj src/JSMR.Api/
|
||||||
|
COPY src/JSMR.Application/JSMR.Application.csproj src/JSMR.Application/
|
||||||
|
COPY src/JSMR.Domain/JSMR.Domain.csproj src/JSMR.Domain/
|
||||||
|
COPY src/JSMR.Infrastructure/JSMR.Infrastructure.csproj src/JSMR.Infrastructure/
|
||||||
|
RUN dotnet restore src/JSMR.Api/JSMR.Api.csproj
|
||||||
|
|
||||||
|
# now copy the rest and publish
|
||||||
|
COPY src/ ./src/
|
||||||
|
RUN dotnet publish src/JSMR.Api/JSMR.Api.csproj -c Release -o /app/publish --no-restore
|
||||||
|
|
||||||
|
# --- Runtime stage ---
|
||||||
|
FROM mcr.microsoft.com/dotnet/aspnet:9.0 AS runtime
|
||||||
|
WORKDIR /app
|
||||||
|
COPY --from=build /app/publish ./
|
||||||
|
# optional: set ASPNETCORE_URLS to port 8080
|
||||||
|
ENV ASPNETCORE_URLS=http://+:8080
|
||||||
|
EXPOSE 8080
|
||||||
|
ENTRYPOINT ["dotnet", "JSMR.Api.dll"]
|
||||||
Reference in New Issue
Block a user