domenkozar / hie-nix

Nix packages for Haskell IDE Engine
115 stars 18 forks source link

Can't install in Docker #64

Closed stereobooster closed 5 years ago

stereobooster commented 5 years ago

Trying to install hie in Docker for theia, but it fails https://github.com/theia-ide/theia-apps/compare/master...stereobooster:haskell-nix?expand=1

ARG NODE_VERSION=10
FROM node:${NODE_VERSION}-stretch

RUN curl -sSL https://get.haskellstack.org/ | sh

RUN addgroup --system nixbld && \
  adduser --home /home/nix --disabled-password --gecos "" --shell /bin/bash nix && \
  adduser nix nixbld && \
  mkdir -m 0755 /nix && chown nix /nix && \
  mkdir -p /etc/nix && echo 'sandbox = false' > /etc/nix/nix.conf

CMD /bin/bash -l
USER nix
ENV USER nix
WORKDIR /home/nix

RUN touch .bash_profile && \
  curl https://nixos.org/nix/install | sh

RUN . /home/nix/.nix-profile/etc/profile.d/nix.sh && \
  nix-env -iA hies -f https://github.com/domenkozar/hie-nix/tarball/master

ARG version=latest

WORKDIR /home/theia
ADD $version.package.json ./package.json
ARG GITHUB_TOKEN
RUN yarn --cache-folder ./ycache && rm -rf ./ycache
RUN yarn theia build
EXPOSE 3000
ENV SHELL /bin/bash
ENTRYPOINT [ "yarn", "theia", "start", "/home/project", "--hostname=0.0.0.0" ]

build log

...
[158 of 220] Compiling Distribution.Simple.Command ( Distribution/Simple/Command.hs, dist/build/Distribution/Simple/Command.o )
[159 of 220] Compiling Distribution.Simple.Setup ( Distribution/Simple/Setup.hs, dist/build/Distribution/Simple/Setup.o )
The command '/bin/sh -c . /home/nix/.nix-profile/etc/profile.d/nix.sh &&   nix-env -iA hies -f https://github.com/domenkozar/hie-nix/tarball/master' returned a non-zero code: 137

Not sure if you can help, but maybe you know what to do. Related https://github.com/haskell/haskell-ide-engine/issues/1244

domenkozar commented 5 years ago

You should probably use nixos/nix docker image.

stereobooster commented 5 years ago

non-zero exit (137) is 128 + 9, which corresponds to kill -9 (from https://success.docker.com/article/what-causes-a-container-to-exit-with-code-137). My guess that it was OOM killer, my docker had limit of 1GB memory, where is hie needs at least 2.

Thanks