So i'm using gcloud run to deploy my docker containers with my angular app. This is my file structure:
Inside of my docker folder there is a startup.sh file which i want to run.
My dockerfile looks like this:
# Stage 0, "build-stage", based on Node.js, to build and compile the frontend
FROM tiangolo/node-frontend:10 as build-stage
WORKDIR /app
COPY package*.json /app/
RUN npm install
COPY ./ /app/
RUN npm run build -- --output-path=./dist/out
# Stage 1, based on Nginx, to have only the compiled app, ready for production with Nginx
FROM nginx:1.15
COPY --from=build-stage /app/dist/out/ /usr/share/nginx/html
# Copy the default nginx.conf provided by tiangolo/node-frontend
COPY --from=build-stage /nginx.conf /etc/nginx/conf.d/default.conf
COPY ../docker /app/
WORKDIR /app/docker
RUN /startup.sh
When gcloud runs my dockerfile i always get this error:
/bin/sh: 1: /startup.sh: not found
So I guess my copy of the docker folder is not working out as I think it does or maybe i'm not in the right folder. I'm very new to docker so there might be something really basic that i've missed here.
Try adding absolute paths.
Make sure that you have bash installed within your container.
Add the permission to execute the file.
Try to run this bash script with a CMD
.
COPY /docker /app/
RUN apk add --no-cache bash
RUN chmod +x /app/docker/startup.sh
# RUN /app/docker/startup.sh
CMD ["/bin/bash", "-c", "/app/docker/startup.sh"]