Skip to content

Commit

Permalink
Remove unused files and update configuration handling
Browse files Browse the repository at this point in the history
Deleted obsolete Docker run configurations and removed `appsettings.Development.json` references. Updated Dockerfile and docker-compose files to use environment variables for configuration, simplifying deployment.
  • Loading branch information
EpicOfficer committed Oct 5, 2024
1 parent a26337c commit 99ff90e
Show file tree
Hide file tree
Showing 13 changed files with 26 additions and 89 deletions.
11 changes: 2 additions & 9 deletions .run/Blink3 Backend.run.xml → .run/Blink3 Development.run.xml
Original file line number Diff line number Diff line change
@@ -1,21 +1,14 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Blink3 Backend" type="docker-deploy" factoryName="docker-compose.yml" server-name="Docker">
<configuration default="false" name="Blink3 Development" type="docker-deploy" factoryName="docker-compose.yml" server-name="Docker">
<deployment type="docker-compose.yml">
<settings>
<option name="envFilePath" value="" />
<option name="commandLineOptions" value="--build" />
<option name="secondarySourceFiles">
<list>
<option value="docker-compose.development.yml" />
</list>
</option>
<option name="services">
<list>
<option value="api" />
<option value="bot" />
<option value="redis" />
<option value="postgres" />
</list>
</option>
<option name="sourceFilePath" value="docker-compose.yml" />
</settings>
</deployment>
Expand Down
24 changes: 0 additions & 24 deletions .run/Blink3.API_Dockerfile.run.xml

This file was deleted.

23 changes: 0 additions & 23 deletions .run/Blink3.Activity_Dockerfile.run.xml

This file was deleted.

15 changes: 0 additions & 15 deletions .run/Blink3.Bot_Dockerfile.run.xml

This file was deleted.

4 changes: 0 additions & 4 deletions Blink3.API/Blink3.API.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,6 @@
<Content Include="..\.dockerignore">
<Link>.dockerignore</Link>
</Content>
<Content Include="..\Configuration\appsettings.Development.json">
<Link>appsettings.Development.json</Link>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="..\Configuration\appsettings.json">
<Link>appsettings.json</Link>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
Expand Down
4 changes: 0 additions & 4 deletions Blink3.Bot/Blink3.Bot.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,6 @@
<Content Include="..\.dockerignore">
<Link>.dockerignore</Link>
</Content>
<Content Include="..\Configuration\appsettings.Development.json">
<Link>appsettings.Development.json</Link>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="..\Configuration\appsettings.json">
<Link>appsettings.json</Link>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
Expand Down
11 changes: 11 additions & 0 deletions Blink3.Web/05-configure.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/sh

set -e

echo "Replacing configuration values.."

# Replace placeholders in appsettings.json with corresponding environment variables
sed -i "s|\${API_ADDRESS}|${API_ADDRESS}|" /usr/share/nginx/html/appsettings.json
sed -i "s|\${CLIENT_ID}|${CLIENT_ID}|" /usr/share/nginx/html/appsettings.json

echo "Configuration values replaced!"
6 changes: 5 additions & 1 deletion Blink3.Web/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,8 @@ RUN dotnet publish "Blink3.Web.csproj" -c $BUILD_CONFIGURATION -o /app/publish /
FROM base AS final
WORKDIR /usr/share/nginx/html
COPY --from=publish /app/publish/wwwroot .
COPY Blink3.Web/nginx.conf /etc/nginx/nginx.conf
COPY Blink3.Web/nginx.conf /etc/nginx/nginx.conf

# Add and run the initialization script
COPY Blink3.Web/05-configure.sh /docker-entrypoint.d/05-configure.sh
RUN chmod +x /docker-entrypoint.d/05-configure.sh
4 changes: 2 additions & 2 deletions Blink3.Web/wwwroot/appsettings.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"ApiAddress": "http://localhost:8288/",
"ClientID": "1223292750766674080"
"ApiAddress": "${API_ADDRESS}",
"ClientID": "${CLIENT_ID}"
}
1 change: 0 additions & 1 deletion Blink3.sln
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Files", "Solution
docker-compose.development.yml = docker-compose.development.yml
docker-compose.yml = docker-compose.yml
Configuration\appsettings.json = Configuration\appsettings.json
Configuration\appsettings.Development.json = Configuration\appsettings.Development.json
.github\workflows\build.yml = .github\workflows\build.yml
.github\workflows\docker-image.yml = .github\workflows\docker-image.yml
README.md = README.md
Expand Down
2 changes: 0 additions & 2 deletions Configuration/appsettings.Development.json

This file was deleted.

5 changes: 3 additions & 2 deletions docker-compose.development.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,9 @@ services:
build:
context: .
dockerfile: Blink3.Web/Dockerfile
volumes:
- ./Blink3.Web/wwwroot/appsettings.json:/usr/share/nginx/html/appsettings.json
environment:
API_ADDRESS: "http://localhost:8288/"
CLIENT_ID: "1223292750766674080"
ports:
- "8280:80"

Expand Down
5 changes: 3 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,9 @@ services:
web:
restart: always
image: ghcr.io/epicofficer/blink3.web:latest
volumes:
- ./appsettings.json:/usr/share/nginx/html/appsettings.json
environment:
API_ADDRESS: "https://api.blinkbot.io/"
CLIENT_ID: "1223292750766674080"
depends_on:
- api
networks:
Expand Down

0 comments on commit 99ff90e

Please sign in to comment.