Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

464
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda