1

I am trying to build a typescript project using docker, but there's an error with tsc. This is my dockerfile

FROM node:alpine AS build

# Create app directory
RUN mkdir -p /app
WORKDIR /app
COPY package.json .
RUN npm install
COPY . .
RUN npm run build:tsc
# RUN npx tsc -p ./tsconfig.json


# Second stage: run things.
FROM node:12
WORKDIR /app

# Install the Javascript dependencies, only runtime libraries.
COPY package.json .

COPY --from=build /app/dist dist
CMD ["npm","run", "start:dev"]

package.json

"start": "node ./dist/server",
"start:dev": "nodemon ./dist/server | bunyan",
"watch:tsc": "tsc --watch -p ./tsconfig.json",
"build:tsc": "tsc -p ./tsconfig.json",
"heroku-postbuild": "npm run build:tsc",

The error I get enter image description here

Bazinga_
  • 95
  • 1
  • 1
  • 5
  • This error doesn’t seem to be related to Docker. Your typescript files won’t compile because some type assignments are upsetting the compiler. – jkr Aug 23 '22 at 15:56
  • You seem to have included an image file in your question instead of the error message. Can you [edit] the question to include the actual error? – David Maze Aug 24 '22 at 13:33
  • Does this answer your question? [How to compile typescript in Dockerfile](https://stackoverflow.com/questions/51083134/how-to-compile-typescript-in-dockerfile) – Max Oct 18 '22 at 06:08

0 Answers0