Skip to content

Commit

Permalink
Merge pull request #1 from Azure-Samples/docs/readme-keys
Browse files Browse the repository at this point in the history
updated doc regarding keys and local docker
  • Loading branch information
jometzg authored Nov 7, 2024
2 parents c9abd5c + 1eb1100 commit 4117e5d
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
1 change: 1 addition & 0 deletions docker/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
keys/
25 changes: 23 additions & 2 deletions docs/LOCAL_CONTAINER_DEBUGGING.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,17 +56,38 @@ docker run -it --env-file ./.env-admin -p 8080:80 local-admin:1
### Local web container run

```
docker run -it --env-file ./.env-web -p 8080:80 local-web:1
docker run -it --env-file ./.env-web -p 8081:80 local-web:1
```

### Local functions container run

```
docker run -it --env-file ./.env.oldfunc -p 8080:80 -v ${HOST_DOCKER_FOLDER:-.}/keys:/azure-functions-host/Secrets local-func:1
docker run -it --env-file ./.env.oldfunc -p 8082:80 -v ${HOST_DOCKER_FOLDER:-.}/keys:/azure-functions-host/Secrets local-func:1
```

in the above, we are taking the file ./docker/function-host.json and copying it to /.docker/keys/hosts.json and then using the "-v" option to mount this file into the container in /azure-functions-hosts/secrets as the file *hosts.json*.

A .gitignore file has been added to the repo to exclude the local hosts.json file from being pushed to the repository

#### Alternative method using a dedicated docker volume

A docker volume can also be used to manage the hosts file so it is external to the repository. The only issue with this is locating the actual folder for the volume within the docker infrastructure of the host file system. Typically on Windows running WSL, this is likely to be
`\\WSL$\docker-desktop-data\version-pack-data\community\docker\volumes`

Choose a name for the volume and create it :

```
docker volume create teams-app-keys
```

As above, copy ./docker/function-host.json into this volume and call it *hosts.json*

Amend the docker run command :

```
docker run -it --env-file ./.env.oldfunc -p 8080:80 -v teams-app-keys:/azure-functions-host/Secrets local-func:1
```

This will allow a REST request to be sent to the running docker container in the following form:

```
Expand Down

0 comments on commit 4117e5d

Please sign in to comment.