diff --git a/.devcontainer/docker-compose.yml b/.devcontainer/docker-compose.yml index 16babb7b528a6d6ae944253963640254f8830f4b..4e71e6d761ba086dc4933bb17ff942bc4f068eac 100644 --- a/.devcontainer/docker-compose.yml +++ b/.devcontainer/docker-compose.yml @@ -4,3 +4,5 @@ services: volumes: - .:/workdir command: sleep infinity + environment: + - TOKEN_ABI_LOCATION=../solidity/token.abi.json diff --git a/.env.sample b/.env.sample new file mode 100644 index 0000000000000000000000000000000000000000..03ce73587a1f511e8aa6fb1fae6c7fca9b1e50df --- /dev/null +++ b/.env.sample @@ -0,0 +1,2 @@ +API_URL=https://sepolia.infura.io/v3/{yourApiKey} +ACCOUNT_PRIVATE_KEY= \ No newline at end of file diff --git a/Frontend/Dockerfile b/Frontend/Dockerfile index d4ed03cc5fa5ccc57b62f133d64ba80f0a7f1807..7e65aa094bb48cbd1902bf6ce5fc73bf2020b888 100644 --- a/Frontend/Dockerfile +++ b/Frontend/Dockerfile @@ -25,6 +25,8 @@ RUN dotnet publish "./Frontend.csproj" -c $BUILD_CONFIGURATION -o /app/publish / # Diese Stufe wird in der Produktion oder bei Ausführung von VS im regulären Modus verwendet (Standard, wenn die Debugkonfiguration nicht verwendet wird). FROM base AS final +ENV TOKEN_ABI_LOCATION="./token.abi.json" WORKDIR /app +COPY solidity/token.abi.json . COPY --from=publish /app/publish . ENTRYPOINT ["dotnet", "Frontend.dll"] diff --git a/Frontend/Program.cs b/Frontend/Program.cs index 74bd7ffe05301abe2702575735dd071aeff38b3a..97774355bbf969f5aba721be54cb899f43929bb1 100644 --- a/Frontend/Program.cs +++ b/Frontend/Program.cs @@ -3,7 +3,10 @@ using Frontend.BackgroundServices; using OpenTelemetry.Metrics; using OpenTelemetry.Resources; -var tokenAbi = File.ReadAllText("../solidity/token.abi.json"); +// the location differ in dev and releas mode. +var tokenAbiLocation = Environment.GetEnvironmentVariable("TOKEN_ABI_LOCATION")!; +var tokenAbi = File.ReadAllText(tokenAbiLocation)!; + var chainApiUrl = Environment.GetEnvironmentVariable("API_URL")!; var accountPrivateKey = Environment.GetEnvironmentVariable("ACCOUNT_PRIVATE_KEY")!; diff --git a/Readme.md b/Readme.md index cc3af820c18c6a40a53d471e66529f9d9d2c9ca3..3ee1ca4102a98c67dfa30bb5b2507087d3befe76 100644 --- a/Readme.md +++ b/Readme.md @@ -3,6 +3,16 @@ # Project Plan: Roesticoin - A Stablecoin on the Ethereum Blockchain +## Getting all running +when switching between Devcontainer and production, rebuild the container, because the base image is different +### For development in Devcontainer +- open in VS Code +- add and modify `.env` file based on `.env.sample` +- reopen in container +### As release in Production +- add and modify `.env` file based on `.env.sample` +- `docker-compose -f docker-compose.yml -f docker-compose.release.yml up --build -d` + ## Project Title: **Roesticoin: Swiss Franc-Pegged Stablecoin on Ethereum**