ranz
ranz

Reputation: 1

Build docker image step is failing in azure devops

I am using docker 20.x version and herewith I will post my package.json dev dependencies and docker file. In my case docker build image step is failing from npm install step.

Docker file:

FROM artifactory.global.standardchartered.com/gv-images-products/scb-bases/gts-1114/node-builder:20.11.0-micro-528704 as build

LABEL       maintainer="[email protected]"
LABEL       description="Wealth Management Advisory (WMA) - RM Portfolio Application"

ENV NODE_OPTIONS=--openssl-legacy-provider

USER root

# NOTE ON PROXIES
#
# When this Dockerfile is used to build an image from DevNet,
# it is necessary to pass HTTP_PROXY and HTTPS_PROXY as --build-arg:
#
#     docker build . -t mydockerimage \
#       --build-arg HTTP_PROXY=http://10.65.1.33:8080 \
#       --build-arg HTTPS_PROXY=http://10.65.1.33:8080
#
# When running the resulting image on DevNet, again it is required to
# pass the proxy:
#
#     docker run mydockerimage \
#       --env HTTP_PROXY=http://10.65.1.33:8080 \
#       --env HTTPS_PROXY=http://10.65.1.33:8080
#
# Note that using http_proxy/https_proxy (i.e. lowercase env var names)
# will not work for _building_ the image. This is because the build arguments
# are overwritten as a result of the way gcc_node is configured.

WORKDIR     /app
COPY         .npmrc *.js *.json ./
COPY         app ./app/
COPY         config ./config/
COPY         public ./public/
COPY         resources ./resources/
COPY         src ./src/
COPY         views ./views/

# server and app have different dependencies so they are installed as separate layers
RUN         npm config set registry https://artifactory.global.standardchartered.com/artifactory/api/npm/npm-release
RUN         npm install -g [email protected]
RUN         npm install --loglevel verbose
RUN         npm run server:build

# Remove node_modules and install for production only
RUN         rm -rf node_modules
RUN         npm install --production --loglevel verbose

# app dependencies are not needed after bundling, so we remove them
# package-lock.json refers to OSX native packages, so install without shrinkwrap
RUN         npm install --no-shrinkwrap --loglevel verbose --prefix app
RUN         NODE_ENV=production npm run build --prefix app
RUN         cd app && rm -rf node_modules

RUN         chmod -R 775 .

FROM artifactory.global.standardchartered.com/gv-images-products/scb-bases/gts-1114/node:20.11.0-micro-528746

WORKDIR     /app

COPY --from=build /app/build ./build

# OpenShift will make it run as a different user, we set it to `daemon` here so that we have a similar environment and can catch problems early

USER daemon

# Set default environment variables

ENV         LOG_PATH=/app/logs/wma/local/rm-portal \
            NODE_ENV=production            

EXPOSE      3000
CMD         node /build/index.js

this is my dev dependencies from package.json file:

"devDependencies": {

    "copy-webpack-plugin": "^5.1.2",

    "cross-env": "^5.2.0",

    "css-loader": "^5.0.1",

    "file-loader": "^6.0.0",

    "mini-css-extract-plugin": "^1.6.1",

    "sass": "^1.64.2",

    "resolve-url-loader": "^3.0.1",

    "sass-loader": "^8.0.2",

    "style-loader": "^2.0.0",

    "webpack": "^5.0.0",

    "webpack-cli": "^5.0.1",

    "webpack-dev-server": "^4.9.2"

}

and this is the error log.

Error message

this is the error message as a text:

ERROR in ./scss/main.scss
Module build failed (from ./node_modules/mini-css-extract-plugin/dist/loader.js):
ModuleBuildError: Module build failed (from ./node_modules/css-loader/dist/cjs.js):
Error: Can't resolve '. ./fonts/fontawesome-webfont.eot?v=4.7.0' in '/app/app/scss'
at finishWithoutResolve (/app/app/node_modules/enhanced-resolve/lib/Resolver.js:564:18)
at /app/app/node_modules/enhanced-resolve/lib/Resolver.js: 656:15
at /app/app/node_modules/enhanced-resolve/lib/Resolver.js: 714:5
at eval (eval at create (/app/app/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:15:1)
at /app/app/node_modules/enhanced-resolve/lib/Resolver.js: 714:5
at eval (eval at create (/app/app/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:27:1)
at /app/app/node_modules/enhanced-resolve/lib/DescriptionFilePlugin.js: 89:43
at /app/app/node_modules/enhanced-resolve/lib/Resolver.js: 714:5
at eval (eval at create (/app/app/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:15:1)
at /app/app/node_modules/enhanced-resolve/lib/Resolver. js: 714:5
at eval (eval at create (/app/app/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:16:1)
at /app/app/node_modules/enhanced-resolve/lib/Resolver.js: 714:5
at eval (eval at create (/app/app/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:16:1)
at /app/app/node_modules/enhanced-resolve/lib/Resolver. js: 714:5
at eval (eval at create (/app/app/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:27:1)
at /app/app/node_modules/enhanced-resolve/lib/DescriptionFilePlugin.js: 89:43
at processResult (/app/app/node_modules/webpack/lib/NormalModule.js:841:19)
at /app/app/node_modules/webpack/lib/NormalModule.js: 966:5
at /app/app/node_modules/loader-runner/lib/LoaderRunner. js: 400:11
at /app/app/node_modules/loader-runner/lib/LoaderRunner.js: 252:18
at context.callback (/app/app/node_modules/loader-runner/lib/LoaderRunner.js:124:13)
at Object. loader (/app/app/node_modules/css-loader/dist/index.js: 155:5)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
@ ./index.js 9:0-26

1 ERROR in child compilations (Use 'stats.children: true' resp. ' -- stats-children' for more details)
webpack 5.91.0 compiled with 2 errors in 7761 ms
Error: building at STEP "RUN NODE_ENV=production npm run build -- prefix app": while running runtime: exit status 1

Does anyone could please advise me how I can fix this issue?

I updated dev dependeies as above but still the issue is exist.

Upvotes: 0

Views: 57

Answers (0)

Related Questions