File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11# go-sqlcmd Development Container
2- FROM mcr.microsoft.com/devcontainers/go:1-1 .24-bookworm
2+ FROM mcr.microsoft.com/devcontainers/go:1.24-bookworm
33
44# Install additional OS packages
55RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
Original file line number Diff line number Diff line change @@ -20,6 +20,7 @@ services:
2020 restart : unless-stopped
2121 environment :
2222 ACCEPT_EULA : " Y"
23+ SA_PASSWORD : " SqlCmd@2025!"
2324 MSSQL_SA_PASSWORD : " SqlCmd@2025!"
2425 MSSQL_PID : " Developer"
2526 volumes :
Original file line number Diff line number Diff line change 1313GO
1414
1515-- Enable contained database authentication for testing
16- EXEC sp_configure ' contained database authentication' , 1 ;
17- RECONFIGURE ;
16+ -- Use TRY/CATCH in case this fails on certain SQL Server configurations
17+ BEGIN TRY
18+ EXEC sp_configure ' contained database authentication' , 1 ;
19+ RECONFIGURE ;
20+ END TRY
21+ BEGIN CATCH
22+ PRINT ' Note: Could not enable contained database authentication (may already be enabled or not supported)' ;
23+ END CATCH ;
1824GO
1925
2026-- Make SqlCmdTest a contained database for testing
21- ALTER DATABASE SqlCmdTest SET CONTAINMENT = PARTIAL ;
27+ BEGIN TRY
28+ ALTER DATABASE SqlCmdTest SET CONTAINMENT = PARTIAL ;
29+ END TRY
30+ BEGIN CATCH
31+ PRINT ' Note: Could not set database containment (may not be supported)' ;
32+ END CATCH ;
2233GO
2334
2435USE SqlCmdTest;
Original file line number Diff line number Diff line change 33
44echo " === go-sqlcmd Development Container Setup ==="
55
6+ # Dynamic workspace detection with fallback
7+ if [ -n " ${WORKSPACE_FOLDER} " ] && [ -d " ${WORKSPACE_FOLDER} " ]; then
8+ cd " ${WORKSPACE_FOLDER} "
9+ elif [ -d " /workspaces/go-sqlcmd" ]; then
10+ cd /workspaces/go-sqlcmd
11+ else
12+ # Find workspace by looking for go.mod
13+ workspace_go_mod=" $( find /workspaces -maxdepth 2 -name ' go.mod' -type f -print -quit 2> /dev/null) "
14+ if [ -n " $workspace_go_mod " ]; then
15+ cd " $( dirname " $workspace_go_mod " ) "
16+ else
17+ echo " Error: Could not determine workspace directory" >&2
18+ exit 1
19+ fi
20+ fi
21+ echo " 📁 Working in: $( pwd) "
22+
623# Download Go dependencies
724echo " 📦 Downloading Go dependencies..."
825go mod download
Original file line number Diff line number Diff line change @@ -60,6 +60,9 @@ CHANGELOG*
6060.pipelines /
6161appveyor.yml
6262
63+ # Dev container configuration (not needed in image build)
64+ .devcontainer /
65+
6366# Test output and temporary files
6467* .log
6568* .tmp
You can’t perform that action at this time.
0 commit comments