Skip to content

Commit

Permalink
Merge pull request #37 from fga-eps-mds/hotfix/adicionando-dockerfile
Browse files Browse the repository at this point in the history
Hotfix/adicionando dockerfile
  • Loading branch information
DenysRogeres authored Jul 15, 2023
2 parents 0aa14d5 + eaa351c commit f14f946
Show file tree
Hide file tree
Showing 5 changed files with 91 additions and 3 deletions.
3 changes: 3 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
EMAIL_SERVICE_ADDRESS=teste
EMAIL_SERVICE_PASSWORD=passaword
EMAIL_DNIT=email
30 changes: 30 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build

WORKDIR /app

COPY UsuarioService.sln ./
COPY app/app.csproj ./app/
COPY dominio/dominio.csproj ./dominio/
COPY repositorio/repositorio.csproj ./repositorio/
COPY service/service.csproj ./service/
COPY test/test.csproj ./test/

RUN dotnet restore

COPY . ./

RUN dotnet build -c Release

RUN dotnet publish app/app.csproj -c Release -o /app/out
RUN dotnet publish service/service.csproj -c Release -o /app/out
RUN dotnet publish repositorio/repositorio.csproj -c Release -o /app/out
RUN dotnet publish dominio/dominio.csproj -c Release -o /app/out
RUN dotnet publish test/test.csproj -c Release -o /app/out

FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS runtime

WORKDIR /app

COPY --from=build /app/out .

ENTRYPOINT ["dotnet", "app.dll"]
42 changes: 41 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,25 @@ git clone https://github.com/fga-eps-mds/2023.1-Dnit-UsuarioService.git
```

### Como Rodar
### Utilizando docker-compose

#### Pré-requisitos
- Docker
- Docker-compose

#### Windows
Rode o seguinte comando na pasta da aplicação.
```bash
docker-compose build && docker-compose up
```


#### Linux ou MacOS
Rode o seguinte comando na pasta da aplicação.
```bash
sudo docker-compose build && sudo docker-compose up
```

#### Usando Visual Studio

Para rodar uma aplicação usando Visual Studio, basta clicar no arquivo com extenção 'sln' e em seguida clicar no ícone para rodar aplicação conforme mostra abaixo:
Expand All @@ -78,7 +97,28 @@ dotnet run

### Encerrando a aplicação

No terminal em que a aplicação esta rodando, digite simultaneamente as teclas **ctrl**+**c**. Caso esteja utilizando o Visual Studio, clique no ícone quadrado vermelho <br>
- No terminal em que a aplicação esta rodando, digite simultaneamente as teclas **ctrl**+**c**.
- Caso esteja utilizando o Visual Studio, clique no ícone quadrado vermelho <br>.

![parar](https://github.com/fga-eps-mds/2023.1-Dnit-EscolaService/assets/54676096/45aedf91-bfb3-4475-afeb-6111a6feabe8)

### Documentação endpoints

Para documentar os endpoints estamos utilizando o Swagger. Caso queira visualizar, basta abrir a rota:
```bash
http://localhost:7083/swagger/index.html
```

<img src="https://github.com/fga-eps-mds/2023.1-Dnit-UsuarioService/assets/54676096/2b2b5fef-7b52-4f40-ab91-c391aaae5d76" alt="swagger-usuarioservice" style="width:800px;">


### Licença

O projeto DnitUsuarioService está sob as regras aplicadas na licença [AGPL-3.0](https://github.com/fga-eps-mds/2023.1-Dnit-UsuarioService/blob/main/LICENSE
)

## Contribuidores

<a href="https://github.com/fga-eps-mds/2023.1-Dnit-UsuarioService/graphs/contributors">
<img src="https://contrib.rocks/image?repo=fga-eps-mds/2023.1-Dnit-UsuarioService" />
</a>
9 changes: 7 additions & 2 deletions app/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,19 @@

builder.Services.AddEndpointsApiExplorer();

builder.WebHost.ConfigureKestrel(options =>
{
options.ListenAnyIP(7083);
});

builder.Services.AddSwaggerGen(options =>
{
options.EnableAnnotations();
options.SwaggerDoc("v1", new OpenApiInfo
{
Version = "v1",
Title = "DNIT",
Description = "Backend DNIT"
Title = "UsuarioService",
Description = "Microserivo UsuarioService"
});
});

Expand Down
10 changes: 10 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
version: "3.0"
services:
usuario-service:
build:
context: .
ports:
- "7083:7083"
container_name: usuarioService
env_file:
- .env

0 comments on commit f14f946

Please sign in to comment.