1

When I run docker build on my codebase, it doesn’t apply the file modifications. I’m using TypeScript with Node as the language/framework. Here is my Dockerfile:

    #Imports the node runtime/os base image
FROM node:14

#like cd into the working directory
WORKDIR /usr/src/app

ENV PORT 8080

#copies the package.json from the local dev machine and pastes it in the ./ directory on google cloud run
COPY package*.json ./

#runs on the cloud run instance terminal
RUN npm install --only=production

#copy the actual code from the . directory (root) and places it in the cloud run root.
COPY . .


EXPOSE 8080

RUN rm -rf src

#Start the service on instance startup
CMD ["npm", "start"]
Jacob Miller
  • 562
  • 4
  • 16
  • you can refer to this link : https://stackoverflow.com/questions/31466428/how-to-restart-a-single-container-with-docker-compose/39501539#39501539 is it helpful? – Divyani Yadav Sep 22 '21 at 10:12
  • How can you tell nothing is changing? How are you starting the corresponding container? – David Maze Sep 22 '21 at 10:19
  • @DivyaniYadav no, this doesn't help. You sent me something for Docker Compose. This isn't Docker compose. – Jacob Miller Sep 22 '21 at 23:26
  • @DavidMaze yes, nothing is changing when I run the container locally and on GCP Cloud Run. I changed some of the express responses and they won't change. However, when I run with nodemon it changes. – Jacob Miller Sep 22 '21 at 23:28
  • For example, that could be the symptom of using a volume mount to hide the image's code, but that would be something that you'd set in the `docker run` command or `docker-compose.yml` file. – David Maze Sep 22 '21 at 23:42
  • @DavidMaze thanks for your help so far. If I set it in the`docker run` command, how do I unset it? – Jacob Miller Sep 22 '21 at 23:56

1 Answers1

0

The issue was that the TS code was not getting compiled into JS code. After explicitly running the compiler and checking the TS config, the problem is resolved.

Jacob Miller
  • 562
  • 4
  • 16