Première tentative de dockerisation, docker compose ne fonctionne pas mais le conteneur de l'api se lance de manière correctement indépendante
parent
7c71bba88c
commit
1b65998d19
@ -0,0 +1,25 @@ |
|||||||
|
**/.classpath |
||||||
|
**/.dockerignore |
||||||
|
**/.env |
||||||
|
**/.git |
||||||
|
**/.gitignore |
||||||
|
**/.project |
||||||
|
**/.settings |
||||||
|
**/.toolstarget |
||||||
|
**/.vs |
||||||
|
**/.vscode |
||||||
|
**/*.*proj.user |
||||||
|
**/*.dbmdl |
||||||
|
**/*.jfm |
||||||
|
**/azds.yaml |
||||||
|
**/bin |
||||||
|
**/charts |
||||||
|
**/docker-compose* |
||||||
|
**/Dockerfile* |
||||||
|
**/node_modules |
||||||
|
**/npm-debug.log |
||||||
|
**/obj |
||||||
|
**/secrets.dev.yaml |
||||||
|
**/values.dev.yaml |
||||||
|
LICENSE |
||||||
|
README.md |
@ -0,0 +1,6 @@ |
|||||||
|
DATABASE_HOSTNAME=localhost |
||||||
|
DATABASE_PORT=3306 |
||||||
|
DATABASE_NAME=collaborateur_epa |
||||||
|
APP_DB_USERNAME=root |
||||||
|
APP_DB_PASSWORD=root |
||||||
|
APP_DB_ROOT_PASSWORD=root |
@ -0,0 +1,20 @@ |
|||||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||||
|
<Project ToolsVersion="15.0" Sdk="Microsoft.Docker.Sdk"> |
||||||
|
<PropertyGroup Label="Globals"> |
||||||
|
<ProjectVersion>2.1</ProjectVersion> |
||||||
|
<DockerTargetOS>Linux</DockerTargetOS> |
||||||
|
<ProjectGuid>815b6abd-7550-4d79-a53b-e84f4d4a7475</ProjectGuid> |
||||||
|
<DockerLaunchAction>LaunchBrowser</DockerLaunchAction> |
||||||
|
<DockerServiceUrl>{Scheme}://localhost:{ServicePort}/swagger</DockerServiceUrl> |
||||||
|
<DockerServiceName>espacecollab.backend.api</DockerServiceName> |
||||||
|
</PropertyGroup> |
||||||
|
<ItemGroup> |
||||||
|
<None Include="certificat-apsdigit-ca.pem" /> |
||||||
|
<None Include="docker-compose.override.yml"> |
||||||
|
<DependentUpon>docker-compose.yml</DependentUpon> |
||||||
|
</None> |
||||||
|
<None Include="docker-compose.yml" /> |
||||||
|
<None Include=".dockerignore" /> |
||||||
|
<None Include=".env" /> |
||||||
|
</ItemGroup> |
||||||
|
</Project> |
@ -0,0 +1,14 @@ |
|||||||
|
version: '3.4' |
||||||
|
|
||||||
|
services: |
||||||
|
espacecollab.backend.api: |
||||||
|
environment: |
||||||
|
- ASPNETCORE_ENVIRONMENT=Development |
||||||
|
- ASPNETCORE_URLS=https://+:443;http://+:80 |
||||||
|
- ASPNETCORE_Kestrel__Certificates__Default__Password=password |
||||||
|
- ASPNETCORE_Kestrel__Certificates__Default__Path=${APPDATA}/ASP.NET/Https/espacecollab.pfx |
||||||
|
ports: |
||||||
|
- "8001:80" |
||||||
|
- "8000:443" |
||||||
|
volumes: |
||||||
|
- ${APPDATA}/ASP.NET/Https:/root/.aspnet/https:ro |
@ -0,0 +1,38 @@ |
|||||||
|
version: '3.4' |
||||||
|
|
||||||
|
volumes: |
||||||
|
data-volume: {} |
||||||
|
|
||||||
|
services: |
||||||
|
|
||||||
|
maria_db: |
||||||
|
image: "mariadb:10.7.1" |
||||||
|
restart: always |
||||||
|
ports: |
||||||
|
- 3304:3306 |
||||||
|
environment: |
||||||
|
- MYSQL_DATABASE=${DATABASE_NAME} |
||||||
|
- MYSQL_USERNAME=${APP_DB_USERNAME} |
||||||
|
- MYSQL_PASSWORD=${APP_DB_PASSWORD} |
||||||
|
- MYSQL_ROOT_PASSWORD=${APP_DB_ROOT_PASSWORD} |
||||||
|
volumes: |
||||||
|
- data-volume:/var/lib/mysql |
||||||
|
|
||||||
|
espacecollab.backend.api: |
||||||
|
image: ${DOCKER_REGISTRY-}espacecollabbackendapi |
||||||
|
build: |
||||||
|
context: . |
||||||
|
dockerfile: espacecollab.backend.api/Dockerfile |
||||||
|
ports: |
||||||
|
- "5000:80" |
||||||
|
- "5001:443" |
||||||
|
links: |
||||||
|
- maria_db |
||||||
|
environment: |
||||||
|
- DATABASE_HOSTNAME=maria_db |
||||||
|
- DATABASE_PORT=3306 |
||||||
|
- DATABASE_NAME=${DATABASE_NAME} |
||||||
|
- DATABASE_USERNAME=${APP_DB_USERNAME} |
||||||
|
- DATABASE_PASSWORD=${APP_DB_PASSWORD} |
||||||
|
|
||||||
|
|
@ -0,0 +1,29 @@ |
|||||||
|
#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging. |
||||||
|
|
||||||
|
FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base |
||||||
|
WORKDIR /app |
||||||
|
EXPOSE 80 |
||||||
|
EXPOSE 443 |
||||||
|
|
||||||
|
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build |
||||||
|
WORKDIR /src |
||||||
|
COPY ["espacecollab.backend.api/espacecollab.backend.api.csproj", "espacecollab.backend.api/"] |
||||||
|
COPY ["espacecollab.backend.appservices/espacecollab.backend.appservices.csproj", "espacecollab.backend.appservices/"] |
||||||
|
COPY ["espacecollab.backend.appservices.dtos/espacecollab.backend.appservices.dtos.csproj", "espacecollab.backend.appservices.dtos/"] |
||||||
|
COPY ["espacecollab.backend.infrastructure.sql.dtos/espacecollab.backend.infrastructure.sql.dtos.csproj", "espacecollab.backend.infrastructure.sql.dtos/"] |
||||||
|
COPY ["espacecollab.backend.appservices.interfaces/espacecollab.backend.appservices.interfaces.csproj", "espacecollab.backend.appservices.interfaces/"] |
||||||
|
COPY ["espacecollab.backend.infrastructure.sql/espacecollab.backend.infrastructure.sql.csproj", "espacecollab.backend.infrastructure.sql/"] |
||||||
|
COPY ["espacecollab.backend.infrastructure.interfaces/espacecollab.backend.infrastructure.interfaces.csproj", "espacecollab.backend.infrastructure.interfaces/"] |
||||||
|
COPY ["espacecollab.backend.infrastructure.fake/espacecollab.backend.infrastructure.fake.csproj", "espacecollab.backend.infrastructure.fake/"] |
||||||
|
RUN dotnet restore "espacecollab.backend.api/espacecollab.backend.api.csproj" |
||||||
|
COPY . . |
||||||
|
WORKDIR "/src/espacecollab.backend.api" |
||||||
|
RUN dotnet build "espacecollab.backend.api.csproj" -c Release -o /app/build |
||||||
|
|
||||||
|
FROM build AS publish |
||||||
|
RUN dotnet publish "espacecollab.backend.api.csproj" -c Release -o /app/publish |
||||||
|
|
||||||
|
FROM base AS final |
||||||
|
WORKDIR /app |
||||||
|
COPY --from=publish /app/publish . |
||||||
|
ENTRYPOINT ["dotnet", "espacecollab.backend.api.dll"] |
Loading…
Reference in new issue