"No jobs found" when using docker-compose up, but direct use of func start behaves as expected
- Dominant language
- PowerShell
- Stars
- 1.1k
- Forks
- 215
- Avg merge
- 4h 2m
- Merged PRs (30d)
- 1
Description
I am trying to use `docker-compose` to containerize my function application written in TypeScript that contains multiple independent functions. I have followed the same steps and directory structure as shown in [this tutorial](https://docs.microsoft.com/en-us/azure/azure-functions/functions-reference). Running locally, I'm able to build and run my functions fine. If I create a docker image and manually create/start a container on my own, I am able to enter that container and start the service with `func start` as expected. The issue is specifically with `docker-compose up` which is giving me inconsistent results, as it is unable to find any functions and the output will contain this message. I have tried variations on playing with the directory structure, as well as different ways of building the container manually and setting the context myself but it would be nice to be able to use `docker-compose` specifically here.
I am running on
- Windows 1903
- Docker version 19.03.2, build 6a30dfc
- npm version 6.13.1
- node version 10.16.3
```
Host.Startup[0]
func_1 | No job functions found. Try making your job classes and methods public. If you're using binding extensions (e.g. Azure Storage, ServiceBus, Timers, etc.) make sure you've called the registration method for the extension(s) in your startup code (e.g. builder.AddAzureStorage(), builder.AddServiceBus(), builder.AddTimers(), etc.).
```
This is my `docker-compose.yaml` which sets the context at one directory level higher as there is shared code required in this portion of the project that is also used elsewhere.
```yaml
version: '3'
services:
func:
build:
context: ../
dockerfile: myFunctionProject/Dockerfile
ports:
- "8080:80"
```
And the directory structure is as follows:
```
ProjectFolder
- subProjectA
- subProjectB
- shared
- myFunctionProject
- host.json
- package.json
- package-lock.json
- tsconfig.json
- funcA
- function.json
- index.ts
- funcB
- function.json
- index.ts
```
This is my `host.json`
```json
{
"version": "2.0",
"extensionBundle": {
"id": "Microsoft.Azure.Functions.ExtensionBundle",
"version": "[1.*, 2.0.0)"
}
}
```
And here is my `Dockerfile`
```docker
FROM mcr.microsoft.com/azure-functions/node:2.0
ENV AzureWebJobsScriptRoot=/home/site/wwwroot/dist/ \
AzureFunctionsJobHost__Logging__Console__IsEnabled=true
# Shared
WORKDIR /home/site/shared
ADD ./shared/package.json /home/site/shared/package.json
ADD ./shared/package-lock.json /home/site/shared/package-lock.json
ADD ./shared/tsconfig.json /home/site/shared/tsconfig.json
RUN npm install
COPY ./shared/src /home/site/shared/src
RUN npm run compile
# App
WORKDIR /home/site/wwwroot
ADD ./myFunctionProject/package.json /home/site/wwwroot/package.json
ADD ./myFunctionProject/package-lock.json /home/site/wwwroot/package-lock.json
ADD ./myFunctionProject/tsconfig.json /home/site/wwwroot/tsconfig.json
ADD ./myFunctionProject/host.json /home/site/wwwroot/host.json
ADD ./myFunctionProject/local.settings.json /home/site/wwwroot/local.settings.json
ADD ./.eslintrc.js /home/site/wwwroot/.eslintrc.js
# Make sure core tools are available for func host
RUN npm i -g azure-functions-core-tools --unsafe-perm true
RUN npm install
COPY ./myFunctionProject/getStatus/ /home/site/wwwroot/getStatus/
COPY ./myFunctionProject/startSession/ /home/site/wwwroot/startSession/
COPY ./myFunctionProject/readTestResult/ /home/site/wwwroot/readTestResult/
RUN npm run build
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.