Repository navigation
Fix/docker compose #72
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
Merged
Merged
Changes from all commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
4a4bf09
FCT : Service d'appel du fournisseur d'Identité
superjekk0 f395708
FCT : Ajout d'utilisateur valide
superjekk0 2ec6366
BUGFIX : Appel au point d'entrée Userinfo
superjekk0 06b7b7a
BUGFIX : Valeurs par défaut manquantes
superjekk0 dbf501f
PROGRES:added cors policy
Yves-Shaheem 98ea773
PROGRES: fixed docker file and compose to fit with 8081
Yves-Shaheem ff0a672
Fix the the docker-compose.yaml file
Yves-Shaheem 78ae92a
README update
Yves-Shaheem 22dafb3
README update
Yves-Shaheem e1e06af
fix the missing file
Yves-Shaheem f783e8a
update env template
Yves-Shaheem c0bce2c
update README, missing text
Yves-Shaheem 2656450
unified the compose
Yves-Shaheem 755b550
PROGRES : Intégration Docker Compose à Visual Studio 2026
superjekk0 53d043d
Réparation du Docker Compose
superjekk0 025325b
FCT : Configuration de l'intégration à Visual Studio
superjekk0 2fa7dda
Réparation du Workflow
superjekk0 1991987
FCT : Attachement de débogueur Visual Studio
superjekk0 3fa0b27
Changement de l'emplacement de compilation cible
superjekk0 61ef247
Essai 2 de la compilation Docker
superjekk0 ce6c41e
Rédaction de documentation
superjekk0 56b0b1f
Suppression de la ConnectionString à la Windows
superjekk0 cc07c87
Ajout de politique CORS par défaut
superjekk0 2801a2b
Merge remote-tracking branch 'origin/feature/authentification-authent…
superjekk0 4e81df5
Normalisation des rôles
superjekk0 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
This file contains hidden or 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
This file was deleted.
Oops, something went wrong.
This file contains hidden or 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
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -4,19 +4,48 @@ This API allows to interface the database and handles business functions | |
| ## Installation | ||
| Different ways can be used to spin up a backend Hello API. | ||
|
|
||
| ### Create the DB | ||
| First of, you need to create a postgreSQL DB if it's not already done. | ||
| ### Creating the DataBase | ||
|
|
||
| > ⚠️ If your database is already created and running, you can skip this step and directly go to [Run the image](#run-the-image). | ||
|
|
||
| Access this [repository](https://github.com/ApplETS/Hello-Database-Setup) to get started! | ||
| The Docker Compose will create a local instance. If you already have a PostgreSQL instance running on your machine, make sure to deactivate it before booting up the Compose, as it will claim the same port. | ||
|
|
||
| ### Installation introduction | ||
|
|
||
| There is two ways you can install the API: | ||
| - Using a docker image: [Docker Installation](#-docker-installation) | ||
| There are multiple ways you can install the API: | ||
| - Using the docker compose file: [Docker Compose](#-docker-compose) | ||
| - Depending on the running parameter you can modify the existing code. | ||
| - Using a docker image: [Docker Installation](#-docker-installation) (Deprecated) | ||
| - This method doesn't allows you to modify easily the existing code and is more suited for a local server when there is only front-end development to be done. | ||
| - Using the classic approach with Visual Studio: [Local Installation](#-local-installation) | ||
| - Using Compose with Visual Studio: [Integrated Compose with Visual Studio](#-compose-with-visual-studio) | ||
|
|
||
| ### 🐳 Docker Compose | ||
| After cloning this repository, open it via a terminal or an IDE. | ||
| ```bash | ||
| cd path/to/repo | ||
| # With an SSH Key | ||
| git clone [email protected]:ApplETS/Backend-Hello.git | ||
| # Without an ssh key | ||
| git clone https://github.com/ApplETS/Backend-Hello.git | ||
| ``` | ||
| You'll need to setup the environment variables in the `.env` file. | ||
| Simply copy and paste the `.env.template` file, rename it to `.env` and fill it with the correct values. | ||
|
|
||
| Or, in the same directory as this README, run this command and fill it with the correct values: | ||
| ```bash | ||
| cp core/.env.template .env | ||
| ``` | ||
| In the same directory as this README, run this the docker compose command: | ||
| ```bash | ||
| docker compose up -d | ||
| ``` | ||
|
|
||
| After running the docker compose file, the api should be accessible via: | ||
| ```bash | ||
| # API | ||
| http://localhost:8081/api | ||
| # SWAGGER | ||
| http://localhost:8081/swagger/index.html | ||
| ``` | ||
| > ⚠️ Don't forget to rebuild the app after modifying the source code, use the command docker compose up -d --build | ||
|
|
||
| ### 🐳 Docker Installation | ||
| Start by pulling the image from docker hub | ||
|
|
@@ -34,42 +63,43 @@ Simply copy and paste the `.env.template` file, rename it to `.env` and fill it | |
|
|
||
| Then, run the image on your local machine | ||
| ```bash | ||
| docker run --env-file .env --restart always -d -p 8080:8080 -v <PATH_TO_VOLUME_FOLDER>:/app/volume:rw --name ps-api ghcr.io/applets/backend-hello:<VERSION> | ||
| docker compose --env-file ./core/.env up -d | ||
| ``` | ||
|
|
||
| You can navigate to `http://localhost:8080/swagger` to check if the API is running correctly! | ||
| You can navigate to `http://localhost:8081/swagger` to check if the API is running correctly! | ||
|
|
||
| ### 👷 Local Installation | ||
| ### 👷 Compose with Visual Studio | ||
| You will need a couple of things to get started developing and maintaining Hello-Backend. | ||
| - [WSL2](https://learn.microsoft.com/en-us/windows/wsl/install). Should be installed with Docker. | ||
| - Docker (suppose to be already installed at this point) | ||
| - [Git](https://git-scm.com/downloads) | ||
| - Visual Studio 2022 or above version. | ||
| - Visual Studio 2022 or above version. (Visual Studio 2026 does not include .NET 8 by default) | ||
| - Make sure to check the ASP.NET and web development component | ||
| <img width="927" alt="image" src="https://github.com/ApplETS/Backend-Hello/assets/25663435/43d8ce41-2990-445b-9621-8f1418d33f0f"> | ||
|
|
||
| - .NET8 (which is supposed to come package with VS2022, but in case it's not.) | ||
| - .NET 8 (Does come with VS2022, but not VS2026) | ||
|
|
||
| NB: Compose is guaranteed to work with a Visual Studio 2026 instance. VS2022 might not work as straightforward. | ||
|
|
||
| #### Setup | ||
| 1. Open Bash, navigate to somewhere you like: | ||
| ```bash | ||
| cd path/to/repo | ||
| ``` | ||
| 2. Clone the repo using an [ssh key](https://docs.github.com/en/authentication/connecting-to-github-with-ssh/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent) or without: | ||
| 2. Clone the repo using an [ssh key](https://docs.github.com/en/authentication/connecting-to-github-with-ssh/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent) or by HTTPS: | ||
| ```bash | ||
| # With an SSH Key | ||
| git clone [email protected]:ApplETS/Backend-Hello.git | ||
| # Without an ssh key | ||
| # With HTTPS | ||
| git clone https://github.com/ApplETS/Backend-Hello.git | ||
| ``` | ||
| 3. Open the .sln in Visual Studio 2022 | ||
| 4. You'll now need to create your `.env` file from the `.env.template`. You can ask help to fill the empty values from a project maintainer. | ||
|
|
||
|
|
||
| #### Running the app using Visual Studio | ||
| To run the app make sure to check Docker to run it using docker: | ||
|
|
||
| <img width="200" alt="image" src="https://github.com/ApplETS/Backend-Hello/assets/25663435/a1dc7a1f-5e53-4361-9e65-95f284ed29fb"> | ||
| To run the app, make sure to select the docker-compose startup project: <img width="200" alt="image" src="./readme_assets/compose-vs-startup.png"> | ||
|
|
||
| Then click on  to run the API. | ||
| Then click on  to run the API. | ||
|
|
||
| You can navigate to http://localhost:8080 where you're app is running. | ||
| You can navigate to http://localhost:8081/swagger where the app is running. | ||
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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 |
|---|---|---|
| @@ -1,29 +1,27 @@ | ||
| FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base | ||
| USER app | ||
| USER $APP_UID | ||
| WORKDIR /app | ||
| EXPOSE 8080 | ||
| EXPOSE 8081 | ||
| EXPOSE 8082 | ||
|
|
||
| FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build | ||
| ARG BUILD_CONFIGURATION=Release | ||
| WORKDIR /src | ||
| COPY ../core/api.core.csproj ./core/ | ||
| COPY ../emails/api.emails.csproj ./emails/ | ||
| COPY ../files/api.files.csproj ./files/ | ||
| COPY ../tests/api.tests.csproj ./tests/ | ||
| COPY ../Hello.sln ./ | ||
| RUN dotnet restore | ||
| COPY ["core/api.core.csproj", "core/"] | ||
| COPY ["emails/api.emails.csproj", "emails/"] | ||
| COPY ["files/api.files.csproj", "files/"] | ||
| RUN dotnet restore "./core/api.core.csproj" | ||
|
|
||
| COPY ../ . | ||
| WORKDIR /src | ||
| RUN dotnet build -c $BUILD_CONFIGURATION -o /app/build | ||
| COPY . . | ||
| WORKDIR "/src/core" | ||
| RUN dotnet build "./api.core.csproj" -c $BUILD_CONFIGURATION -o /app/build | ||
|
|
||
| FROM build AS publish | ||
| ARG BUILD_CONFIGURATION=Release | ||
| RUN dotnet publish -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false | ||
| RUN dotnet publish "./api.core.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false | ||
|
|
||
| FROM base AS runtime | ||
| FROM base AS final | ||
| WORKDIR /app | ||
| COPY --chown=app --from=publish /app/publish . | ||
| COPY --chown=$APP_UID --from=publish /app/publish . | ||
| RUN mkdir -p /app/volume # create volume directory to store images | ||
| ENTRYPOINT ["dotnet", "api.core.dll"] | ||
| ENTRYPOINT ["dotnet", "api.core.dll"] |
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.