-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #29 from D0nKarnag3/feature/containerize
Feature/containerize
- Loading branch information
Showing
2 changed files
with
56 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
name: Build and publish docker image | ||
|
||
on: | ||
pull_request: | ||
push: | ||
branches: | ||
- 'master' | ||
|
||
jobs: | ||
docker: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- | ||
name: Set up QEMU | ||
uses: docker/setup-qemu-action@v1 | ||
- | ||
name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v1 | ||
- | ||
name: Login to DockerHub | ||
uses: docker/login-action@v1 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
- | ||
name: Build and push to Docker hub | ||
id: docker_build | ||
uses: docker/build-push-action@v2 | ||
with: | ||
push: true | ||
tags: hviid84/dbmigrator:latest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
FROM mcr.microsoft.com/dotnet/runtime:5.0.11-alpine3.14-amd64 AS base | ||
WORKDIR /app | ||
RUN apk add --no-cache icu-libs | ||
ENV DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=false | ||
|
||
FROM mcr.microsoft.com/dotnet/sdk:5.0.402-alpine3.14-amd64 AS build | ||
|
||
WORKDIR /src | ||
COPY ./DBMigrator.Console/DBMigrator.Console.csproj DBMigrator.Console/DBMigrator.Console.csproj | ||
COPY ./DBMigrator/DBMigrator.csproj DBMigrator/DBMigrator.csproj | ||
COPY ./DBMigrator.Test/DBMigrator.Test.csproj DBMigrator.Test/DBMigrator.Test.csproj | ||
RUN dotnet restore -f DBMigrator.Console/DBMigrator.Console.csproj | ||
|
||
COPY ../ . | ||
RUN dotnet build -c Release -o /app DBMigrator.Console/DBMigrator.Console.csproj | ||
|
||
FROM build AS test | ||
|
||
RUN dotnet test | ||
|
||
FROM base AS final | ||
|
||
WORKDIR /app | ||
COPY --from=build /app . | ||
ENTRYPOINT [ "dotnet", "DBMigrator.Console.dll" ] |