Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

472
Visualizações
TypeScript compilation failing inside Dockerfile

I have the following Dockerfile which is failing at the step which compiles TypeScript:

FROM node:12
WORKDIR /usr/src/app

# SETUP

COPY package.json .
COPY tsconfig.json .
COPY src .

RUN npm install -g yarn@^1.16.0
RUN yarn install

# BUILD

RUN npx tsc <------------------------

The error message is very confusing:

File '/usr/src/app/app.ts' is not under 'rootDir' '/usr/src/app/src'. 'rootDir' is expected to contain all source files.

This makes no sense... It's finding app.ts under the src folder and then complaining that it isn't under the src folder.

Files:

src
  app.ts
tsconfig.json
Dockerfile

How do I solve this issue?

Here is my tsconfig.json:

{
  "compilerOptions": {
    ...
    "rootDir": "./src",
    "outDir": "./build",
    ...
  }
}
over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

Wow, it was such a simple problem unrelated to TypeScript.

I didn't do the COPY command correctly.

When copying files you can do COPY <filename> .

But apparently for directories you must do COPY <dirname> <dirname>

So I fixed this by changing COPY src . to COPY src src.

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda