NestJS start command returning Killed with no error in conatiner

Viewed 470

I am trying to get NestJS up and running in my container. Currently, I have this set up as my docker-compose.yml


services:
  redis-cluster:
    image: internal-repo.com/devops/redis-cluster:5.0.5
    ports:
      - 7000:7000
      - 7001:7001
      - 7002:7002
      - 7003:7003
      - 7004:7004
      - 7005:7005
      - 7006:7006
      - 7007:7007
      - 7008:7008
    environment:
      IP: 0.0.0.0
      MASTERS: 3
      SLAVES_PER_MASTER: 2
  app-orders:
    image: app-orders
    build:
      context: ..
      dockerfile: $PWD/Dockerfile
    working_dir: /workspace
    depends_on:
      - 'redis-cluster'
    environment:
      NODE_ENV: development
    volumes:
      - ..:/workspace
    ports:
      - 50099:9229
      - 3000:3000
    command: /bin/sh -c "while sleep 1000; do :; done"

I have this for my Dockerfile

FROM internal-repo.com/devops/node/ubuntu-1804:12.16.2 as build-env
ENV NODE_VERSION 12.16.2

WORKDIR /workspace

RUN apt-get update && apt install python -y
# Ensure the image timezone mirrorsCorp HQ
ENV TZ=America/Los_Angeles
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone

COPY .devcontainer/library-scripts/docker-debian.sh /tmp/library-scripts/
COPY package.json package.json

RUN npm i -g nodemon
RUN npm i -g @nestjs/cli
RUN npm install

# App specific environment
ENV PACKAGE_JSON_PATH ../package.json

I have set my docker to run the sleep command so I can start this container and run an interactive shell with it. If i tried to put the npm command as the run, it would just crash after a few minutes.

In an interactive shell, I have tried running npm start:dev which uses rimraf to remove the dist folder and then run nest start --watch. The problem is, it will run for a little bit, generate the new dist folder and then promptly die. It only says in the npm log Error 147. If i try to run the nest start --watch manually, it sits for a little bit saying 'Starting compilation in Watch Mode' and just says "Killed". I don't know why it is failing or what to fix.

The odd thing is, if I don't try and run it in the container, it will run fine on my mac (assuming i have the redis cluster up and running already in a container)

0 Answers
Related