I am currently learning Docker and trying to follow this course (https://devopswithdocker.com/part-1/section-6/) to develop my skills. Although I was able to do everything until now, I am stuck on this exercise (1.12 down the page):
I have made a Dockerfile to containerize the project (exampel-frontend) by following the instructions from the read-me file ( https://github.com/docker-hy/material-applications/blob/main/example-frontend/README.md) with the following code (actually I have written almost similar but this is the solution that can be found here: https://github.com/oneiromancy/devops-with-docker
FROM ubuntu:latest
WORKDIR /usr/src
COPY . .
RUN apt-get update && apt-get install -y curl && curl https://deb.nodesource.com/setup_14.x | apt-get install -y nodejs
RUN apt-get install -y npm && npm install && npm run build && npm install -g serve
CMD ["npx", "serve", "-s", "-l", "8080", "build"]
EXPOSE 8080
However, when I build and run the container :
docker build . -t hello-frontend
docker run -p 8080:8080 hello-frontend
I get the following error:
file:///usr/local/lib/node_modules/serve/build/main.js:169
const ipAddress = request.socket.remoteAddress?.replace("::ffff:", "") ?? "unknown";
^
SyntaxError: Unexpected token '.'
at Loader.moduleStrategy (internal/modules/esm/translators.js:133:18)
at async link (internal/modules/esm/module_job.js:42:21)
Could you help me to fix it as I need this application to be running for the following exercises ...
Thank you!