简体   繁体   中英

Foreman not found on docker

I'm trying to create a docker file to run my rails application. When I try and start the container it fails with foreman: executable file not found in $PATH .

Dockerfile

FROM ruby:2.7.2 as builder
ENV RAILS_ENV="production"
COPY . /app
WORKDIR /app
RUN gem install bundler:2.1.4
RUN apt-get update && apt-get install -y nodejs libpq-dev build-essential patch --no-install-recommends && rm -rf /var/lib/apt/lists/*
RUN bundle config set deployment 'true' && \
    bundle config set without 'development test'
RUN bundle install
RUN gem install foreman

FROM ruby:2.7.2
ENV RAILS_ENV="production" \
    RAILS_SERVE_STATIC_FILES="yes"
    # SECRET_KEY_BASE="your_production_key" \
# RUN install_packages libssl1.1
COPY --from=builder /app /app
WORKDIR /app
EXPOSE 3000
CMD ["foreman", "start"]

You installed foreman in the builder, but you are executing it in the main container.

If you want to run a program in the container, you need to install it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM