diff --git a/DockerfileFunctionDictation.dockerfile b/DockerfileFunctionDictation.dockerfile index 3dcb7b2..4b3356f 100644 --- a/DockerfileFunctionDictation.dockerfile +++ b/DockerfileFunctionDictation.dockerfile @@ -1,12 +1,29 @@ -# To enable ssh & remote debugging on app service change the base image to the one below -# FROM mcr.microsoft.com/azure-functions/node:4-node18-appservice +#ビルドイメージ +FROM node:18.17.1-buster AS build-container +WORKDIR /app +RUN mkdir dictation_function +COPY dictation_function/ dictation_function/ +RUN npm install --force -g n && n 18.17.1 \ + && cd dictation_function \ + && npm ci \ + && npm run build \ + && cd .. + +# 成果物イメージ FROM mcr.microsoft.com/azure-functions/node:4-node18 +WORKDIR /home/site/wwwroot +RUN mkdir build \ + && mkdir dist \ + && mkdir node_modules + +COPY --from=build-container app/dictation_function/dist/ dist/ +COPY --from=build-container app/dictation_function/node_modules/ node_modules/ +COPY --from=build-container app/dictation_function/.env ./ +COPY --from=build-container app/dictation_function/host.json ./ +COPY --from=build-container app/dictation_function/package.json ./ + +ARG BUILD_VERSION ENV AzureWebJobsScriptRoot=/home/site/wwwroot \ - AzureFunctionsJobHost__Logging__Console__IsEnabled=true - -COPY . /home/site/wwwroot - -RUN cd /home/site/wwwroot && \ - npm install && \ - npm run build \ No newline at end of file + AzureFunctionsJobHost__Logging__Console__IsEnabled=true \ + BUILD_VERSION=${BUILD_VERSION} \ No newline at end of file diff --git a/dictation_function/Dockerfile b/dictation_function/Dockerfile deleted file mode 100644 index 3dcb7b2..0000000 --- a/dictation_function/Dockerfile +++ /dev/null @@ -1,12 +0,0 @@ -# To enable ssh & remote debugging on app service change the base image to the one below -# FROM mcr.microsoft.com/azure-functions/node:4-node18-appservice -FROM mcr.microsoft.com/azure-functions/node:4-node18 - -ENV AzureWebJobsScriptRoot=/home/site/wwwroot \ - AzureFunctionsJobHost__Logging__Console__IsEnabled=true - -COPY . /home/site/wwwroot - -RUN cd /home/site/wwwroot && \ - npm install && \ - npm run build \ No newline at end of file