This is the error that I am getting from runnning the workflow
#17 [final 3/6] COPY --from=builder /home/node/app/dist/apps//* /usr/share/nginx/html
#17 ERROR: lstat /var/lib/docker/tmp/buildkit-mount3999339759/home/node/app/dist/apps: no such file or directory
------
> [final 3/6] COPY --from=builder /home/node/app/dist/apps//* /usr/share/nginx/html:
------
Dockerfile:14
--------------------
12 |
13 | RUN rm /usr/share/nginx/html/index.html
14 | >>> COPY --from=builder /home/node/app/dist/apps/$PROJECT_NAME/* /usr/share/nginx/html
15 | COPY nginx/default.conf /etc/nginx/conf.d/default.conf
16 | COPY nginx/nginx.conf /etc/nginx/nginx.conf
--------------------
ERROR: failed to solve: lstat /var/lib/docker/tmp/buildkit-mount3999339759/home/node/app/dist/apps: no such file or directory
Error: buildx failed with: ERROR: failed to solve: lstat /var/lib/docker/tmp/buildkit-mount3999339759/home/node/app/dist/apps: no such file or directory
This is the docker file
FROM node:18.17-alpine AS builder
ARG PROJECT_NAME
USER node
RUN mkdir -p /home/node/app
WORKDIR /home/node/app
COPY --chown=node package.json .
RUN yarn install --verbose
COPY --chown=node . .
RUN yarn build $PROJECT_NAME production
FROM nginx:1.15.8-alpine AS final
RUN rm /usr/share/nginx/html/index.html
COPY --from=builder /home/node/app/dist/apps/$PROJECT_NAME/* /usr/share/nginx/html
COPY nginx/default.conf /etc/nginx/conf.d/default.conf
COPY nginx/nginx.conf /etc/nginx/nginx.conf
RUN apk update
The Workflow is like this
name: Build Check On PR
on:
workflow_call:
inputs:
ENV_VARIABLES_PATH:
required: true
type: string
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set Environment Variables
uses: ./.github/actions/setvars
with:
varFilePath: ${{ inputs.ENV_VARIABLES_PATH }}
- name: Set up Docker
uses: actions/setup-node@v3
with:
node-version: '14'
- name: Build check
uses: docker/build-push-action@v2
with:
context: .
build-args: |
PROJECT_NAME=${{ env.PROJECT_NAME }}
push: false
It was working 4 days eariler and now anything I do or any previous successful build, its throwing this error.
Where is the issue I don’t understand, I looked into the latest changes too, but it was nothing related to the configuration of .github.
As the error message suggests
#17 [final 3/6] COPY --from=builder /home/node/app/dist/apps//* /usr/share/nginx/html
^here
Your build arg PROJECT_NAME
is undefined!
Upon looking docker/build-push-action@v2
the build-args
should be a list, so try changing to this
- name: Build check
uses: docker/build-push-action@v2
with:
context: .
build-args:
- "PROJECT_NAME=${{ env.PROJECT_NAME }}" #here
push: false
You may also try accessing the variable like this
RUN yarn build ${PROJECT_NAME} production
Or maybe your github env is just no set