Open axcdnt opened 4 years ago
Sorry for the headaches @axcdnt ! You shouldn't need to explicitly include the bundle
binary using the --include-exe
flag. Is there a difference if you try to use the standard (non-alpine base image for ruby (like in this example: https://github.com/docker-slim/examples/tree/master/ruby2_rails5_standard
)?
Let me try to repro the condition to see what's going on...
You can do --include-path=/usr/local/bin/bundle
, but then you will have a bunch of other problems with alpine.
I gave up on
docker-slim build --include-shell --include-path=/usr/local/bin/bundle --include-path=/usr/local/lib/ruby --include-path=/usr/lib api_api:latest
It seems docker-slim and alpine are not working together well, right?
@sergey-koba-mobidev it should be working... are you experiencing a similar problem?
Yes, I am trying to docker-slim FROM ruby:2.6-alpine3.11
image and have the same problem
@sergey-koba-mobidev how does your Dockerfile look like? Does it look like this https://github.com/docker-slim/examples/blob/master/ruby2_rails5_standard/Dockerfile or do you have something special for the entrypoint/cmd?
Here it is:
FROM ruby:2.6-alpine3.11
ENV LANG C.UTF-8
ENV MAXMIND_DB_LOCATION /tmp/GeoLite2-City.mmdb
RUN mkdir -p /var/log/unicorn
RUN mkdir -p /usr/src/api
WORKDIR /usr/src/api
RUN apk add --update --upgrade gcc less postgresql-dev libsass imagemagick \
git build-base xz-dev libc6-compat nodejs python python-dev \
postgresql-client curl unzip linux-headers && \
gem install libv8 -v '3.16.14.3' -- --with-system-v8 && \
rm -rf /var/cache/apk/*
RUN apk add --no-cache gmp-dev
COPY . /usr/src/api
RUN bundle install --jobs 20
COPY assets/GeoLite2-City.mmdb /tmp/GeoLite2-City.mmdb
EXPOSE 3000
CMD ["unicorn_rails", "-c", "config/unicorn.conf.rb"]
@sergey-koba-mobidev thanks for sharing your Dockerfile! Working on a repro... I'll share my updates soon :)
a number of new Rails/Alpine examples:
still working on a rails/unicorn repro...
Thank you @kcq !
@sergey-koba-mobidev here's the latest rails/alpine example and it uses unicorn_rails to start the app: https://github.com/docker-slim/examples/blob/master/ruby2_rails5_alpine_unicorn_rails/Dockerfile
It looks like there's something else going on... I noticed that you install the libv8
gem and also nodejs
. What do you have in your Gemfile and what are you doing with libv8 and nodejs there? Wonder if you use the execjs
gem somehow too...
I have a Ruby app based on
ruby:2.5.3-alpine
with aCMD
that cannot find bundler.It's being built as:
docker-slim build --http-probe --include-shell --include-exe sleep --include-exe grep --include-exe jq --include-exe /usr/local/bin/bundle myapp
CMD:
CMD ["./scripts/server.sh"]
server.sh:
I'm not sure if
--include-exe
pointing to bundler's absolute path is correct. I also tried--include-bin
without success.When running docker-compose pointing to
my-app.slim
, it raises the following error:my-app | ./scripts/server.sh: line 4: bundle: not found
Let me know if you have any idea. Thanks in advance!