https://github.com/elct9620/ruby-pycall
The ruby docker image with python support for PyCall
https://github.com/elct9620/ruby-pycall
docker python ruby
Last synced: 3 months ago
JSON representation
The ruby docker image with python support for PyCall
- Host: GitHub
- URL: https://github.com/elct9620/ruby-pycall
- Owner: elct9620
- Created: 2023-12-27T13:39:38.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-12-28T11:46:10.000Z (over 2 years ago)
- Last Synced: 2025-03-23T03:30:46.338Z (over 1 year ago)
- Topics: docker, python, ruby
- Language: Dockerfile
- Homepage:
- Size: 12.7 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Ruby with Python
===
The `ruby` slim with additional python for [pycall.rb](https://github.com/mrkn/pycall.rb/tree/master)
## Example
```dockerfile
# Specify Version
ARG RUBY_VERSION=3.3.0
ARG PYTHON_VERSION=3.12.1
# Install Ruby Gems
FROM ruby:${RUBY_VERSION} AS gem
RUN mkdir -p /src/app
COPY Gemfile Gemfile.lock /src/app/
WORKDIR /src/app
RUN gem install bundler:2.5.3 \
&& bundle config --local deployment 'true' \
&& bundle config --local frozen 'true' \
&& bundle config --local no-cache 'true' \
&& bundle config --local without 'development test cli' \
&& bundle install -j "$(getconf _NPROCESSORS_ONLN)" \
&& find /src/app/vendor/bundle -type f -name '*.c' -delete \
&& find /src/app/vendor/bundle -type f -name '*.h' -delete \
&& find /src/app/vendor/bundle -type f -name '*.o' -delete \
&& find /src/app/vendor/bundle -type f -name '*.gem' -delete
# Install Python Packages
FROM python:${PYTHON_VERSION} AS pip
RUN mkdir -p /src/app
COPY requiremets.txt /src/app/requirements.txt
WORKDIR /src/app
RUN pip install -r /src/app/requirements.txt
# Use "ruby-pycall" as base image
FROM ghcr.io/elct9620/ruby-pycall:${RUBY_VERSION}-py${PYTHON_VERSION}
RUN mkdir -p /src/app
WORKDIR /src/app
# Copy Ruby Gems
COPY --from=gem /usr/local/bundle/config /usr/local/bundle/config
COPY --from=gem /usr/local/bundle /usr/local/bundle
COPY --from=gem /src/app/vendor/bundle /src/app/vendor/bundle
# Copy Python Packages
ARG PYTHON_MINOR_VERSION=3.12
COPY --from=pip /usr/local/lib/python${PYTHON_MINOR_VERSION}/site-packages/ /usr/local/lib/python${PYTHON_MINOR_VERSION}/site-packages
# Copy Source Code
COPY . .
# Run server
CMD ["bundle", "exec", "rails", "server"]
```