Help creating a docker image from DockerFile

I have Docker Desktop 4.19.0 (106363) installed
as well as a DockerFile. But its different then what i expected and so was hoping someone could help me create an image from it?
This DockerFile is for our react ui and runs on node. If its not possible (or difficult) to get an image from this file, would it be possible to get an image from the internet, with node, then put our app on it?

FROM node:16.13.0

# Application version as displayed to user in login screen (mandatory)
# It must be provided in the docker build command
ARG REACT_APP_VERSION

# Check args
RUN echo REACT_APP_VERSION : ${REACT_APP_VERSION:?Build argument REACT_APP_VERSION needs to be set and non-empty.}

WORKDIR /app

COPY . /app/

RUN npm install -g npm@8.19.2

RUN echo "REACT_APP_VERSION=$REACT_APP_VERSION" > .env
RUN npm i && npm run build

EXPOSE 3000

CMD [ "npm", "run", "prod" ]

I did try, import and build already

C:\og\work\coderepo\eclipse\symphony-ui-react>docker build .
[+] Building 1.8s (7/12)
 => [internal] load build definition from Dockerfile                                                               0.0s
 => => transferring dockerfile: 536B                                                                               0.0s
 => [internal] load .dockerignore                                                                                  0.0s
 => => transferring context: 2B                                                                                    0.0s
 => [internal] load metadata for docker.io/library/node:16.13.0                                                    1.0s
 => [auth] library/node:pull token for registry-1.docker.io                                                        0.0s
 => CACHED [1/7] FROM docker.io/library/node:16.13.0@sha256:580a0850049c59a48f06090edd48c9f966c5e6572bbbabc369ba3  0.0s
 => CANCELED [internal] load build context                                                                         0.8s
 => => transferring context: 34.89MB                                                                               0.4s
 => ERROR [2/7] RUN echo REACT_APP_VERSION : ${REACT_APP_VERSION:?Build argument REACT_APP_VERSION needs to be se  0.8s
------
 > [2/7] RUN echo REACT_APP_VERSION : ${REACT_APP_VERSION:?Build argument REACT_APP_VERSION needs to be set and non-empty.}:
#0 0.723 /bin/sh: 1: REACT_APP_VERSION: Build argument REACT_APP_VERSION needs to be set and non-empty.
------
WARNING: buildx: git was not found in the system. Current commit information was not captured by the build
Dockerfile:8
--------------------
   6 |
   7 |     # Check args
   8 | >>> RUN echo REACT_APP_VERSION : ${REACT_APP_VERSION:?Build argument REACT_APP_VERSION needs to be set and non-empty.}
   9 |
  10 |     WORKDIR /app
--------------------
ERROR: failed to solve: process "/bin/sh -c echo REACT_APP_VERSION : ${REACT_APP_VERSION:?Build argument REACT_APP_VERSION needs to be set and non-empty.}" did not complete successfully: exit code: 2

C:\og\work\coderepo\eclipse\symphony-ui-react>docker build Dockerfile
[+] Building 0.0s (0/0)
ERROR: unable to prepare context: path "Dockerfile" not found

C:\og\work\coderepo\eclipse\symphony-ui-react>dir Dockerfile*
 Volume in drive C has no label.
 Volume Serial Number is D2A9-8416

 Directory of C:\og\work\coderepo\eclipse\symphony-ui-react

07/18/2024  08:13 AM               497 Dockerfile
               1 File(s)            497 bytes
               0 Dir(s)  147,588,055,040 bytes free

C:\og\work\coderepo\eclipse\symphony-ui-react>

Your dockerfile is using build arguments, you need to specify them

1 Like