node.js typescript docker dockerfile google-cloud-run
Updated Sun, 04 Sep 2022 18:52:19 GMT

Docker Build CLI Doesn’t update the code (TS, node)

When I run docker build on my codebase, it doesnt apply the file modifications. Im 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
#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 . .
RUN rm -rf src
#Start the service on instance startup
CMD ["npm", "start"]


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.