Skip to content

Commit

Permalink
updates to docker compose and devcontainer.json files
Browse files Browse the repository at this point in the history
  • Loading branch information
madebygps committed Nov 18, 2023
1 parent 3533276 commit aabd853
Show file tree
Hide file tree
Showing 11 changed files with 65 additions and 162 deletions.
8 changes: 6 additions & 2 deletions .devcontainer/api/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,17 @@
"vscode": {
"extensions": [
"ms-azuretools.vscode-azurefunctions",
"ms-dotnettools.csharp"
"ms-dotnettools.csharp",
"rangav.vscode-thunder-client",
"GitHub.copilot"

]
}
},

// Uncomment the next line to run commands after the container is created.
// "postCreateCommand": "cat /etc/os-release",
"postCreateCommand": "chmod +x /workspace/api/setup.sh; /workspace/api/setup.sh"


// Configure tool-specific properties.
// "customizations": {},
Expand Down
14 changes: 10 additions & 4 deletions .devcontainer/frontend/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/docker-existing-docker-compose
{
"name": "Existing Docker Compose (Extend)",
"name": "JS Frontend",

// Update the 'dockerComposeFile' list if you have more compose files or use different names.
// The .devcontainer/docker-compose.yml file contains any overrides you need/want to make.
"dockerComposeFile": [
"../docker-compose.yml",
"docker-compose.yml"
"../../docker-compose.yml"
],

// The 'service' property is the name of the service for the container that VS Code should
Expand All @@ -16,7 +15,14 @@

// The optional 'workspaceFolder' property is the path VS Code should open by default when
// connected. This is typically a file mount in .devcontainer/docker-compose.yml
"workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}"
"workspaceFolder": "/workspace/frontend",
"customizations": {
"vscode": {
"extensions": [
"ms-vscode.live-server"
]
}
}

// Features to add to the dev container. More info: https://containers.dev/features.
// "features": {},
Expand Down
26 changes: 0 additions & 26 deletions .devcontainer/frontend/docker-compose.yml

This file was deleted.

6 changes: 0 additions & 6 deletions api/.vscode/extensions.json

This file was deleted.

19 changes: 10 additions & 9 deletions api/.vscode/launch.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "Attach to .NET Functions",
"type": "coreclr",
"request": "attach",
"processId": "${command:azureFunctions.pickProcess}"
}
]
"version": "0.2.0",
"configurations": [

{
"name": "Attach to .NET Functions",
"type": "coreclr",
"request": "attach",
"processId": "${command:azureFunctions.pickProcess}"
}
]
}
7 changes: 0 additions & 7 deletions api/.vscode/settings.json

This file was deleted.

88 changes: 9 additions & 79 deletions api/.vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -1,81 +1,11 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "clean (functions)",
"command": "dotnet",
"args": [
"clean",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"type": "process",
"problemMatcher": "$msCompile",
"options": {
"cwd": "${workspaceFolder}/testing"
}
},
{
"label": "build (functions)",
"command": "dotnet",
"args": [
"build",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"type": "process",
"dependsOn": "clean (functions)",
"group": {
"kind": "build",
"isDefault": true
},
"problemMatcher": "$msCompile",
"options": {
"cwd": "${workspaceFolder}/testing"
}
},
{
"label": "clean release (functions)",
"command": "dotnet",
"args": [
"clean",
"--configuration",
"Release",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"type": "process",
"problemMatcher": "$msCompile",
"options": {
"cwd": "${workspaceFolder}/testing"
}
},
{
"label": "publish (functions)",
"command": "dotnet",
"args": [
"publish",
"--configuration",
"Release",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"type": "process",
"dependsOn": "clean release (functions)",
"problemMatcher": "$msCompile",
"options": {
"cwd": "${workspaceFolder}/testing"
}
},
{
"type": "func",
"dependsOn": "build (functions)",
"options": {
"cwd": "${workspaceFolder}/testing23/bin/Debug/net7.0"
},
"command": "host start",
"isBackground": true,
"problemMatcher": "$func-dotnet-watch"
}
]
"version": "2.0.0",
"tasks": [
{
"type": "func",
"command": "host start",
"problemMatcher": "$func-watch",
"isBackground": true,
}
]
}
25 changes: 0 additions & 25 deletions api/api.sln

This file was deleted.

16 changes: 16 additions & 0 deletions api/setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash

# Import the public repository GPG keys
curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.gpg

# Move the GPG key to the appropriate directory
sudo mv microsoft.gpg /etc/apt/trusted.gpg.d/microsoft.gpg

# Set up the stable repository
sudo sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/debian/$(lsb_release -rs | cut -d'.' -f 1)/prod $(lsb_release -cs) main" > /etc/apt/sources.list.d/dotnetdev.list'

# Update the package lists for upgrades and new packages
sudo apt-get update

# Install the Azure Functions Core Tools
sudo apt-get install azure-functions-core-tools-4
14 changes: 12 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ services:
# Mount the root folder that contains .git
- .:/workspace:cached
command: sleep infinity
links:
- frontend
networks:
- mynetwork
# ...

frontend:
Expand All @@ -16,4 +16,14 @@ services:
# Mount the root folder that contains .git
- .:/workspace:cached
command: sleep infinity
networks:
- mynetwork

networks:
mynetwork:
driver: bridge
ipam:
driver: default


# ...
4 changes: 2 additions & 2 deletions frontend/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ window.addEventListener('DOMContentLoaded', (event) =>{
})

const functionApiUrl = 'https://getvisitorcounter.azurewebsites.net/api/GetVisitorCounter';
const localFunctionApi = 'http://localhost:7071/api/GetResumeCounter';
const localFunctionApi = 'http://localhost:7071/api/GetVisitorCounter';

const getVisitCount = () => {
let count = 30;
fetch(functionApiUrl).then(response => {
fetch(localFunctionApi).then(response => {
return response.json()
}).then(response =>{
console.log("Website called function API.");
Expand Down

0 comments on commit aabd853

Please sign in to comment.