docker icon indicating copy to clipboard operation
docker copied to clipboard

`/bin/bash: line 1: heroku: command not found` in docker container

Open jonasfroeller opened this issue 1 year ago • 0 comments

I am trying to use the heroku cli in a bun environment.
It works locally, but does not work in the docker container.
I tried installing it via npm -g too.
I tested it in node:current-bullseye and that works.

This is my Dockerfile:

FROM oven/bun:1.1.6-debian # also tried oven/bun:1.0.30-debian

# Needed for the node:child_process module, TODO: maybe replace it with a bun specific module in the future
RUN apt-get update && apt-get install -y build-essential

WORKDIR /app

COPY package.json .
COPY bun.lockb .

RUN bun install --production

RUN curl https://cli-assets.heroku.com/install.sh | sh
ENV PATH="${PATH}:/usr/local/bin/heroku" # also tried ENV PATH="$PATH:/usr/local/bin/heroku"
RUN echo 'export PATH="/usr/local/bin/heroku:$PATH"' >> ~/.bashrc
RUN . ~/.bashrc
RUN heroku --version

COPY src src
COPY static static
COPY tsconfig.json .

ENV NODE_ENV production
CMD ["bun", "src/index.ts"]

EXPOSE 80

RUN heroku --version throws
ERROR: failed to solve: process "/bin/sh -c heroku --version" did not complete successfully: exit code: 127

jonasfroeller avatar Apr 29 '24 08:04 jonasfroeller