2 years ago
#64008

Edward
Gitub Action npm install Module not found: Error: Can't resolve './src/services/meekouapi.ts' in '/usr/local/app'
I am trying deploy Excel Addin to docker image.
The command npm run build:prod
and docker build -t excel .
in local environment works.
But, it will fail with the Github action below:
name: Docker Image CI For Excel
on:
push:
tags:
- 'excel-v*'
jobs:
push_to_registry:
name: Push Docker image to Docker Hub
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v2
- name: Log in to Docker Hub
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
with:
images: xxx/xx
- name: Build and push Docker image
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
with:
context: ./
file: ./Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
Here is the error from Github Action
#13 [build 5/5] RUN npm run build:prod
#13 0.626
#13 0.626 > excel-custom-functions@2.0.0 build:prod
#13 0.626 > webpack --mode production
#13 0.626
#13 12.02 assets by status 217 KiB [cached] 22 assets
#13 12.02 runtime modules 221 bytes 1 module
#13 12.02 modules by path ./node_modules/core-js/modules/*.js 243 KiB 230 modules
#13 12.02 modules by path ./node_modules/core-js/internals/*.js 158 KiB 177 modules
#13 12.02 modules by path ./src/ 17 KiB
#13 12.02 modules with errors 117 bytes [errors] 3 modules
#13 12.02 modules by path ./src/services/*.ts 5.36 KiB
#13 12.02 ./src/services/common.model.ts 266 bytes [built] [code generated]
#13 12.02 ./src/services/http.ts 5.1 KiB [built] [code generated]
#13 12.02 ./src/functions/functions.ts 3.54 KiB [built] [code generated]
#13 12.02 ./src/taskpane/taskpane.ts 4.3 KiB [built] [code generated]
#13 12.02 ./src/pages/data-from-web/data-from-web.ts 3.68 KiB [built] [code generated]
#13 12.02 ./node_modules/core-js/stable/index.js 9.62 KiB [built] [code generated]
#13 12.02 ./node_modules/regenerator-runtime/runtime.js 24 KiB [built] [code generated]
#13 12.02 ./node_modules/node-fetch/browser.js 732 bytes [built] [code generated]
#13 12.02
#13 12.02 ERROR in ./src/commands/commands.ts
#13 12.02 Module build failed (from ./node_modules/ts-loader/index.js):
#13 12.02 Error: TypeScript emitted no output for /usr/local/app/src/commands/commands.ts.
#13 12.02 at makeSourceMapAndFinish (/usr/local/app/node_modules/ts-loader/dist/index.js:52:18)
#13 12.02 at successLoader (/usr/local/app/node_modules/ts-loader/dist/index.js:39:5)
#13 12.02 at Object.loader (/usr/local/app/node_modules/ts-loader/dist/index.js:22:5)
#13 12.02
#13 12.02 ERROR in ./src/dialog/dialog.ts
#13 12.02 Module build failed (from ./node_modules/ts-loader/index.js):
#13 12.02 Error: TypeScript emitted no output for /usr/local/app/src/dialog/dialog.ts.
#13 12.02 at makeSourceMapAndFinish (/usr/local/app/node_modules/ts-loader/dist/index.js:52:18)
#13 12.02 at successLoader (/usr/local/app/node_modules/ts-loader/dist/index.js:39:5)
#13 12.02 at Object.loader (/usr/local/app/node_modules/ts-loader/dist/index.js:22:5)
#13 12.02
#13 12.02 ERROR in ./src/login/login.ts
#13 12.02 Module build failed (from ./node_modules/ts-loader/index.js):
#13 12.02 Error: TypeScript emitted no output for /usr/local/app/src/login/login.ts.
#13 12.02 at makeSourceMapAndFinish (/usr/local/app/node_modules/ts-loader/dist/index.js:52:18)
#13 12.02 at successLoader (/usr/local/app/node_modules/ts-loader/dist/index.js:39:5)
#13 12.02 at Object.loader (/usr/local/app/node_modules/ts-loader/dist/index.js:22:5)
#13 12.02
#13 12.02 ERROR in meekou
#13 12.02 Module not found: Error: Can't resolve './src/services/meekouapi.ts' in '/usr/local/app'
#13 12.02
#13 12.02 ERROR in meekou
#13 12.02 Module not found: Error: Can't resolve './src/shared/appconsts.ts' in '/usr/local/app'
Here is the dockerfile
# Use official node image as the base image
FROM node:16-alpine3.12 as build
# Set the working directory
WORKDIR /usr/local/app
# Add the source code to app
COPY ./ ./
# Install all the dependencies
RUN npm install
# Generate the build of the application
RUN npm run build:prod
# Stage 2: Serve app with nginx server
# Use official nginx image as the base image
FROM nginx:latest
# Copy the build output to replace the default nginx contents.
COPY --from=build /usr/local/app/dist/ /usr/share/nginx/html
#COPY /nginx.conf /etc/nginx/conf.d/default.conf
# Assign permisson
# https://stackoverflow.com/questions/49254476/getting-forbidden-error-while-using-nginx-inside-docker
# RUN chown nginx:nginx /usr/share/nginx/html/*
# Expose port 80
EXPOSE 80
EXPOSE 443
webpack
dockerfile
office-js
github-actions
excel-addins
0 Answers
Your Answer