Skip to content

Commit

Permalink
Merge pull request #48 from fga-eps-mds/hotfix/adicionando_dockerizacao
Browse files Browse the repository at this point in the history
Dockerizando aplicacao e atualizando readme
  • Loading branch information
DenysRogeres authored Jul 15, 2023
2 parents dbebd06 + 3447a4d commit b3087ba
Show file tree
Hide file tree
Showing 5 changed files with 98 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 EscolaService.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"]
49 changes: 48 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,33 @@ git clone https://github.com/fga-eps-mds/2023.1-Dnit-EscolaService.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:
<br>
![rodar](https://github.com/fga-eps-mds/2023.1-Dnit-EscolaService/assets/54676096/c7f08d0f-e1e7-45ab-b5a4-bbf1089ce1d8)
![rodar](https://github.com/fga-eps-mds/2023-1-CAPJu-Services/assets/54676096/e601faf8-1a9b-438a-a8fb-d9bb1078be3b)


#### Usando Visual Studio Code

Expand All @@ -89,5 +111,30 @@ dotnet run

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:7084/swagger/index.html
```

<img src="https://github.com/fga-eps-mds/2023-1-CAPJu-Services/assets/54676096/e3756afe-546f-4501-af41-595e3a596c6a" alt="swagger-usuarioservice" style="width:800px;">


### Licença

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


## Contribuidores

<a href="https://github.com/fga-eps-mds/2023.1-Dnit-EscolaService/graphs/contributors">
<img src="https://contrib.rocks/image?repo=fga-eps-mds/2023.1-Dnit-EscolaService" />
</a>



9 changes: 7 additions & 2 deletions app/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,19 @@

builder.Services.AddEndpointsApiExplorer();

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

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

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:
escola-service:
build:
context: .
ports:
- "7084:7084"
container_name: escolaService
env_file:
- .env

0 comments on commit b3087ba

Please sign in to comment.