Skip to content

Commit

Permalink
feat: Add Dockerfile changes and expose port 5432
Browse files Browse the repository at this point in the history
Added changes to the Dockerfile to expose port 5432.
  • Loading branch information
SenexCrenshaw committed Feb 5, 2024
1 parent e78e28d commit 78afc55
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 7 deletions.
2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ COPY env.sh /env.sh
RUN chmod +x /entrypoint.sh /env.sh
RUN mkdir /config

EXPOSE 5432

ENTRYPOINT ["/entrypoint.sh", "dotnet", "StreamMaster.API.dll"]

STOPSIGNAL SIGINT
2 changes: 2 additions & 0 deletions Dockerfile.template
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ COPY env.sh /env.sh
RUN chmod +x /entrypoint.sh /env.sh
RUN mkdir /config

EXPOSE 5432

ENTRYPOINT ["/entrypoint.sh", "dotnet", "StreamMaster.API.dll"]

STOPSIGNAL SIGINT
9 changes: 2 additions & 7 deletions StreamMaster.Domain/Common/BuildInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,7 @@ public static class BuildInfo
{
static BuildInfo()
{
Assembly? assembly = Assembly.GetEntryAssembly();
if (assembly is null)
{
throw new InvalidOperationException("Failed to get entry assembly.");
}

Assembly? assembly = Assembly.GetEntryAssembly() ?? throw new InvalidOperationException("Failed to get entry assembly.");
Version = assembly.GetName().Version ?? new Version(0, 0, 0, 0);
object[] attributes = assembly.GetCustomAttributes(true);

Expand Down Expand Up @@ -146,7 +141,7 @@ private static void InitializePaths()
/// <returns>The environment variable's value or the default value.</returns>
private static string GetEnvironmentVariableOrDefault(string name, string defaultValue)
{
string envVar = Environment.GetEnvironmentVariable(name);
string? envVar = Environment.GetEnvironmentVariable(name);
return !string.IsNullOrEmpty(envVar) ? envVar : defaultValue;
}

Expand Down
23 changes: 23 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,29 @@ if [ "$PUID" -ne 0 ] || [ "$PGID" -ne 0 ]; then

fi

# File path
FILE="/config/DB/postgresql.conf"
# Line to add
LINE="listen_addresses = '*'"

# Check if the line already exists in the file
if ! grep -qF "$LINE" "$FILE"; then
# If the line does not exist, append it to the file
echo "$LINE" | tee -a "$FILE" > /dev/null
fi

# File path
FILE="/config/DB/pg_hba.conf"
# Line to add
LINE="host all all 0.0.0.0/0 trust"

# Check if the line already exists in the file
if ! grep -qF "$LINE" "$FILE"; then
# If the line does not exist, append it to the file
echo "$LINE" | tee -a "$FILE" > /dev/null
fi


chown -R postgres:postgres $PGDATA

# Pretty printing the configuration
Expand Down

0 comments on commit 78afc55

Please sign in to comment.