mirror of
https://github.com/aaronpo97/the-biergarten-app.git
synced 2026-02-16 20:13:49 +00:00
update docker compose
This commit is contained in:
@@ -4,12 +4,8 @@ using System.Text;
|
|||||||
using Konscious.Security.Cryptography;
|
using Konscious.Security.Cryptography;
|
||||||
using Microsoft.Data.SqlClient;
|
using Microsoft.Data.SqlClient;
|
||||||
|
|
||||||
// @todo store this securely using environment variables or a secret manager
|
|
||||||
const string connectionString =
|
string ConnectionString = Environment.GetEnvironmentVariable("SEEDDB_CONNECTION_STRING")!;
|
||||||
@"Data Source=AARONPC\INFO5052;Integrated Security=True;
|
|
||||||
Persist Security Info=False;Pooling=False;
|
|
||||||
MultipleActiveResultSets=False;Encrypt=True;
|
|
||||||
TrustServerCertificate=True;Connection Timeout=30;";
|
|
||||||
|
|
||||||
static async Task BuildSchema(SqlConnection connection)
|
static async Task BuildSchema(SqlConnection connection)
|
||||||
{
|
{
|
||||||
@@ -202,7 +198,7 @@ static string GetScriptPath(string fileName)
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
await using SqlConnection connection = new(connectionString);
|
await using SqlConnection connection = new(ConnectionString);
|
||||||
await connection.OpenAsync();
|
await connection.OpenAsync();
|
||||||
Console.WriteLine("Connection to database established successfully.");
|
Console.WriteLine("Connection to database established successfully.");
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
services:
|
services:
|
||||||
sqlserver:
|
sqlserver:
|
||||||
image: mcr.microsoft.com/mssql/server:2022-latest
|
image: mcr.microsoft.com/mssql/server:2022-latest
|
||||||
|
platform: linux/amd64
|
||||||
container_name: sqlserver
|
container_name: sqlserver
|
||||||
environment:
|
environment:
|
||||||
ACCEPT_EULA: "Y"
|
ACCEPT_EULA: "Y"
|
||||||
@@ -9,6 +10,37 @@ services:
|
|||||||
- "1433:1433"
|
- "1433:1433"
|
||||||
volumes:
|
volumes:
|
||||||
- sqlserverdata:/var/opt/mssql
|
- sqlserverdata:/var/opt/mssql
|
||||||
|
healthcheck:
|
||||||
|
test: [ "CMD", "/opt/mssql-tools18/bin/sqlcmd", "-C", "-S", "localhost", "-U", "sa", "-P", "YourStrong!Passw0rd", "-Q", "SELECT 1" ]
|
||||||
|
interval: 10s
|
||||||
|
timeout: 5s
|
||||||
|
retries: 12
|
||||||
|
networks:
|
||||||
|
- devnet
|
||||||
|
|
||||||
|
dotnet:
|
||||||
|
image: mcr.microsoft.com/dotnet/sdk:9.0
|
||||||
|
container_name: dotnet-sdk
|
||||||
|
tty: true
|
||||||
|
stdin_open: true
|
||||||
|
volumes:
|
||||||
|
- ./:/home/dev/projects # bind mount your repo for live code edits
|
||||||
|
- nuget-cache:/home/dev/.nuget/packages
|
||||||
|
- ~/.gitconfig:/home/dev/.gitconfig:ro
|
||||||
|
working_dir: /home/dev/projects
|
||||||
|
environment:
|
||||||
|
DOTNET_CLI_TELEMETRY_OPTOUT: "1"
|
||||||
|
HOME: /home/dev
|
||||||
|
USER: dev
|
||||||
|
SEEDDB_CONNECTION_STRING: "Server=sqlserver,1433;User Id=sa;Password=YourStrong!Passw0rd;Encrypt=True;TrustServerCertificate=True;Connection Timeout=30;"
|
||||||
|
user: root
|
||||||
|
networks:
|
||||||
|
- devnet
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
sqlserverdata:
|
sqlserverdata:
|
||||||
|
nuget-cache:
|
||||||
|
|
||||||
|
networks:
|
||||||
|
devnet:
|
||||||
|
driver: bridge
|
||||||
|
|||||||
Reference in New Issue
Block a user