I really need help here as I have tried everything that I can think of.. I have a react JS app docker container built on alpine which runs perfectly on AWS Fargate. However, when I deploy and run the same on EC2 instance with ECS, I a getting this error "exec /docker-entrypoint.sh: exec format error".
Here is my dockerfile:
#!/bin/bash
FROM --platform=linux/x86_64 node:16-alpine AS builder
WORKDIR /app
COPY package.json .
COPY package-lock.json .
RUN npm install --production
COPY . .
RUN npm run build
FROM nginx:1.21.0-alpine as production
ENV NODE_ENV production
COPY --from=builder /app/build /usr/share/nginx/html
COPY nginx/nginx.conf /etc/nginx/conf.d/default.conf
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]
Also, when I inspect the container, some key details are below:
"Entrypoint": ["/docker-entrypoint.sh"],
"Architecture": "amd64", "Os": "linux", "Size": 26545012,
I read on some forums that i need to add "#!/bin/bash" to the start of the file docker-entrypoint.sh.. However, this file is auto generated while building the container. So how can I add this line?
I will really appreciate any help..