I'm using Github actions to build and push a docker container to Azure Repository within a react-native-web application. The strange thing is that in my local Windows 10 machine the build process of the react web app works but in Github Action no. It complains about a Typescript error (the application have been written in TS). Being the build process executed in the same dockerized Ubuntu machine, I thought that the result should always be the same but it's not.
This is my Github action
# This is a basic workflow to help you get started with Actionsname: Publish Web Client prod# Controls when the action will run. Triggers the workflow on push or pull request# events but only for the master branchon: push: branches: publish-web-prod# A workflow run is made up of one or more jobs that can run sequentially or in paralleljobs: # This workflow contains a single job called "build" build: # The type of runner that the job will run on runs-on: ubuntu-latest # Steps represent a sequence of tasks that will be executed as part of the job steps: - name: Checkout uses: actions/checkout@v2 # allow to login to azure registry container - name: Login to Azure uses: azure/docker-login@v1 with: login-server: registryviatek.azurecr.io username: ${{ secrets.REGISTRY_USERNAME }} password: ${{ secrets.REGISTRY_PASSWORD }} # Runs a set of commands using the runners shell - name: Run build and publish web prod run: | docker build -f ${{ github.workspace }}/src/app/DockerfileGithubProd -t registry.azurecr.io/frontendweb-prod:${{ github.sha }} --no-cache . docker push registry.azurecr.io/frontendweb-prod:${{ github.sha }}
This is my docker file:
# build environmentFROM node:14.15.5-alpine as buildRUN apk updateRUN apk add gitWORKDIR /appENV PATH /app/node_modules/.bin:$PATHCOPY src/app/package.json /app/package.jsonRUN npm install --silentRUN npm install react-scripts@3.4.1 -g --silentCOPY src/app /appRUN npm run build# production environmentFROM nginx:1.17.4-alpineCOPY --from=build /app/build /usr/share/nginx/htmlRUN rm /etc/nginx/conf.d/default.confCOPY src/app/nginx/nginx.conf /etc/nginx/conf.dEXPOSE 80CMD ["nginx", "-g", "daemon off;"]
And this is the outout log from Github:
Run docker build -f /home/runner/work/App/App/src/app/DockerfileGithubTest -t ***.azurecr.io/frontendweb-test:df0a8964152d2bf50917e59de0af1d2a93e88783 --no-cache . docker build -f /home/runner/work/App/App/src/app/DockerfileGithubTest -t ***.azurecr.io/frontendweb-test:df0a8964152d2bf50917e59de0af1d2a93e88783 --no-cache . docker push ***.azurecr.io/frontendweb-test:df0a8964152d2bf50917e59de0af1d2a93e88783 shell: /usr/bin/bash -e {0} env: DOCKER_CONFIG: /home/runner/work/_temp/docker_login_1617897140374Sending build context to Docker daemon 15.17MBStep 1/16 : FROM node:14.15.5-alpine as build14.15.5-alpine: Pulling from library/node0a6724ff3fcd: Pulling fs layer3b3c21ce1f8c: Pulling fs layer560ed84bbbcc: Pulling fs layer281a19a6c438: Pulling fs layer281a19a6c438: Waiting0a6724ff3fcd: Verifying Checksum0a6724ff3fcd: Download complete281a19a6c438: Verifying Checksum281a19a6c438: Download complete0a6724ff3fcd: Pull complete3b3c21ce1f8c: Verifying Checksum3b3c21ce1f8c: Download complete560ed84bbbcc: Verifying Checksum560ed84bbbcc: Download complete3b3c21ce1f8c: Pull complete560ed84bbbcc: Pull complete281a19a6c438: Pull completeDigest: sha256:5edad160011cc8cfb69d990e9ae1cb2681c0f280178241d58eba05b5bfc34047Status: Downloaded newer image for node:14.15.5-alpine ---> c1babb15a629Step 2/16 : RUN apk update ---> Running in 25acb5a203e5fetch http://dl-cdn.alpinelinux.org/alpine/v3.11/main/x86_64/APKINDEX.tar.gzfetch http://dl-cdn.alpinelinux.org/alpine/v3.11/community/x86_64/APKINDEX.tar.gzv3.11.10-8-gf8ac3999ba [http://dl-cdn.alpinelinux.org/alpine/v3.11/main]v3.11.10-2-gc655f5d2f5 [http://dl-cdn.alpinelinux.org/alpine/v3.11/community]OK: 11278 distinct packages availableRemoving intermediate container 25acb5a203e5 ---> 63fdb83b1dfdStep 3/16 : RUN apk add git ---> Running in 2a8874928a55(1/6) Installing ca-certificates (20191127-r2)(2/6) Installing nghttp2-libs (1.40.0-r1)(3/6) Installing libcurl (7.67.0-r3)(4/6) Installing expat (2.2.9-r1)(5/6) Installing pcre2 (10.34-r1)(6/6) Installing git (2.24.4-r0)Executing busybox-1.31.1-r9.triggerExecuting ca-certificates-20191127-r2.triggerOK: 23 MiB in 22 packagesRemoving intermediate container 2a8874928a55 ---> 5bc04a41d9c2Step 4/16 : WORKDIR /app ---> Running in d5c9efa1b69aRemoving intermediate container d5c9efa1b69a ---> 5dbe08ad7bbdStep 5/16 : ENV PATH /app/node_modules/.bin:$PATH ---> Running in e9066449d147Removing intermediate container e9066449d147 ---> 65f6dbf0d570Step 6/16 : COPY src/app/package.json /app/package.json ---> 073aeb43cf5cStep 7/16 : RUN npm install --silent ---> Running in 0ef783dd1abbDownload the fileDownload completed!Extract contentExtract complete!Delete the downloaded fileadded 2188 packages from 1166 contributors and audited 2198 packages in 74.182s100 packages are looking for funding run `npm fund` for detailsfound 9 vulnerabilities (6 low, 3 high) run `npm audit fix` to fix them, or `npm audit` for detailsRemoving intermediate container 0ef783dd1abb ---> b1fbb2e35cebStep 8/16 : RUN npm install react-scripts@3.4.1 -g --silent ---> Running in 8d1c76d8f6ab/usr/local/bin/react-scripts -> /usr/local/lib/node_modules/react-scripts/bin/react-scripts.js+ react-scripts@3.4.1added 1618 packages from 748 contributors in 43.313sRemoving intermediate container 8d1c76d8f6ab ---> eac5ceccd774Step 9/16 : COPY src/app /app ---> 5bc1cff62d99Step 10/16 : RUN npm run build:test ---> Running in 141e7cf15400> App@0.0.2 build:test /app> env-cmd -f .env.staging react-app-rewired buildCreating an optimized production build...Failed to compile./app/src/features/login/login-form/index.tsxTypeScript error in /app/src/features/login/login-form/index.tsx(38,8):Type '{ style: { backgroundColor: string; }; icon: string; size: number; color: string; }' is missing the following properties from type 'Pick<Props, "ref" | "style" | "hitSlop" | "onLayout" | "pointerEvents" | "removeClippedSubviews" | "testID" | "nativeID" | "collapsable" | "needsOffscreenAlphaCompositing" | ... 48 more ... | "icon">': accessibilityComponentType, accessibilityTraits TS2739 36 | <Image source={require('../../../images/header.png')} resizeMode="center"></Image> 37 | > 38 | <Avatar.Icon style={styles.avatarLockIcon} icon="lock" size={40} color="white"></Avatar.Icon> | ^ 39 | <ViaText type="title" text="Accedi" style={styles.avatarLocktxt}></ViaText> 40 | </View> 41 |npm ERR! code ELIFECYCLEnpm ERR! errno 1npm ERR! ViaVoipApp@0.0.2 build:test: `env-cmd -f .env.staging react-app-rewired build`npm ERR! Exit status 1npm ERR! npm ERR! Failed at the ViaVoipApp@0.0.2 build:test script.npm ERR! This is probably not a problem with npm. There is likely additional logging output above.npm ERR! A complete log of this run can be found in:npm ERR! /root/.npm/_logs/2021-04-08T15_56_54_595Z-debug.logThe command '/bin/sh -c npm run build:test' returned a non-zero code: 1Error: Process completed with exit code 1.
I know that the error seems right to be raised but if I run npm run build
or build the container on my local machine, they works.