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

Develop #3

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
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
20 changes: 20 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
FROM mcr.microsoft.com/dotnet/aspnet:5.0 AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443

FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build
WORKDIR /app
COPY ConversaoPeso.Web/ConversaoPeso.Web.csproj ./ConversaoPeso.Web/
RUN dotnet restore ./ConversaoPeso.Web/ConversaoPeso.Web.csproj
COPY . .
WORKDIR /app/ConversaoPeso.Web
RUN dotnet build

FROM build AS publish
RUN dotnet publish -o /app/publish

FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "ConversaoPeso.Web.dll"]
35 changes: 34 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,34 @@
# conversao-peso
# conversao-peso
# 🐳 Desafio 01 - Docker

## conversao-peso

## Adiconado multistage build com docker

``` sh
docker image build -t hernanisoares/conversaopeso:v1 .
docker image tag hernanisoares/conversaopeso:v1 hernanisoares/conversaopeso:latest
```

- libera o terminal
``` sh
docker container run -d -p 8080:80 --name conversaopeso hernanisoares/conversaopeso:v1
```

- terminal preso, porem ao enccerrar a plicação, o container é deletado
``` sh
docker container run -rm -d -p 8080:80 --name conversaopeso hernanisoares/conversaopeso:v1
```

- logue no registry docker hub

``` sh
docker login
```

- envie para o registry sua imagem

``` sh
docker push hernanisoares/conversaopeso:v1
docker push hernanisoares/conversaopeso:latest
```