Skip to content

Commit 6904590

Browse files
committed
fixed support for devcontainers #4
1 parent 9f9a621 commit 6904590

File tree

9 files changed

+63
-17
lines changed

9 files changed

+63
-17
lines changed

.devcontainer/Dockerfile

-7
This file was deleted.

.devcontainer/devcontainer.json

+3-7
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
{
22
"name": "Azure Developer CLI",
3-
"build": {
4-
"dockerfile": "Dockerfile",
5-
"args": {
6-
"IMAGE": "dotnet:7.0-bullseye"
7-
}
8-
},
3+
"image": "mcr.microsoft.com/devcontainers/dotnet:8.0-bookworm",
94
"features": {
105
"ghcr.io/devcontainers/features/docker-in-docker:2": {
116
},
@@ -25,11 +20,12 @@
2520
"ms-azuretools.vscode-docker",
2621
"ms-dotnettools.csharp",
2722
"ms-dotnettools.vscode-dotnet-runtime",
23+
"ms-dotnettools.csdevkit",
2824
"ms-vscode.vscode-node-azure-pack"
2925
]
3026
}
3127
},
32-
"postCreateCommand": "",
28+
"postCreateCommand": "bash scripts/install-dev-tools.sh",
3329
"remoteUser": "vscode",
3430
"hostRequirements": {
3531
"memory": "8gb"

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -402,3 +402,4 @@ FodyWeavers.xsd
402402
azuredeploy.parameters.json
403403
*.zip
404404
.azure/
405+
.mono/

README.md

+9-1
Original file line numberDiff line numberDiff line change
@@ -156,9 +156,17 @@ once finished, create a `./func/local.settings.json` and `.env` starting from pr
156156
From the sample root folder run:
157157

158158
```bash
159-
swa start ./client --api-location ./func --data-api-location ./swa-db-connections
159+
swa start
160160
```
161161

162+
and once the local Static Web App environment is running, you can connect to
163+
164+
```text
165+
http://localhost:4280/
166+
```
167+
168+
and test the solution locally.
169+
162170
## Fluent UI
163171

164172
The solution uses Fluent UI for the UI components. The Fluent UI is a collection of UX frameworks from Microsoft that provides a consistent design language for web, mobile, and desktop applications. More details about Fluent UI can be found at the following links:

database/SessionRecommender/session_recommender_v2.sqlproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<Project DefaultTargets="Build">
3-
<Sdk Name="Microsoft.Build.Sql" Version="0.1.12-preview" />
3+
<Sdk Name="Microsoft.Build.Sql" Version="0.1.15-preview" />
44
<PropertyGroup>
55
<Name>session_recommender_v2</Name>
66
<ProjectGuid>{A3BB1F3B-AAAF-4735-A73F-46B26F8B66C0}</ProjectGuid>

func/SessionProcessor.cs

+2-1
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,9 @@ public class Item
1717
[JsonPropertyName("require_embeddings_update")]
1818
public bool RequireEmbeddingsUpdate { get; set; }
1919

20-
public override bool Equals(object obj)
20+
public override bool Equals(object? obj)
2121
{
22+
if (obj is null) return false;
2223
if (obj is not Item that) return false;
2324
return Id == that.Id;
2425
}

scripts/install-dev-tools.sh

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
sudo cp ./scripts/ms-repo.pref /etc/apt/preferences.d/
2+
3+
export dotnet_version="6.0"
4+
export dab_version="0.9.7"
5+
export sqlcmd_version="1.6.0"
6+
export func_version="4"
7+
export sqlprj_version="0.1.15-preview"
8+
9+
export debian_version=$(if command -v lsb_release &> /dev/null; then lsb_release -r -s; else grep -oP '(?<=^VERSION_ID=).+' /etc/os-release | tr -d '"'; fi)
10+
11+
wget https://packages.microsoft.com/config/debian/$debian_version/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
12+
sudo dpkg -i packages-microsoft-prod.deb
13+
rm packages-microsoft-prod.deb
14+
sudo apt update
15+
16+
sudo apt install dotnet-sdk-$dotnet_version -y
17+
18+
npm i -g azure-functions-core-tools@$func_version --unsafe-perm true
19+
20+
npm install -g @azure/static-web-apps-cli
21+
22+
dotnet tool install -g microsoft.sqlpackage
23+
dotnet new install Microsoft.Build.Sql.Templates::$sqlprj_version
24+
25+
26+
dotnet tool install -g Microsoft.DataApiBuilder --version $dab_version
27+
28+
sudo apt-get install sqlcmd
29+
sudo wget https://github.com/microsoft/go-sqlcmd/releases/download/v$sqlcmd_version/sqlcmd-v$sqlcmd_version-linux-amd64.tar.bz2
30+
sudo bunzip2 sqlcmd-v$sqlcmd_version-linux-amd64.tar.bz2
31+
sudo tar xvf sqlcmd-v$sqlcmd_version-linux-amd64.tar
32+
sudo mv sqlcmd /usr/bin/sqlcmd
33+
sudo rm sqlcmd-v$sqlcmd_version-linux-amd64.tar
34+
sudo rm sqlcmd_debug
35+
sudo rm NOTICE.md
36+
37+
if [[ ":$PATH:" == *":$HOME/.dotnet/tools:"* ]]; then
38+
echo "Path already includes ~/.dotnet/tools, skipping."
39+
else
40+
echo "Adding ~/.dotnet/tools to path."
41+
echo 'PATH=$PATH:$HOME/.dotnet/tools' >> ~/.bashrc
42+
fi

scripts/ms-repo.pref

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Package: dotnet* aspnet* netstandard*
2+
Pin: origin "archive.ubuntu.com"
3+
Pin-Priority: -10

swa-cli.config.json

+2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
"client": {
55
"appLocation": "client",
66
"outputLocation": "dist",
7+
"apiLocation": "func",
8+
"dataApiLocation": "swa-db-connections",
79
"appBuildCommand": "npm run build",
810
"run": "npm run dev"
911
}

0 commit comments

Comments
 (0)