├── .github └── workflows │ └── build.yml ├── 2.5 └── Dockerfile ├── 2.6 └── Dockerfile ├── 2.7 └── Dockerfile ├── 3.0 └── Dockerfile ├── Dockerfile ├── LICENSE.txt ├── README.md └── build.sh /.github/workflows/build.yml: -------------------------------------------------------------------------------- 1 | on: push 2 | jobs: 3 | build: 4 | strategy: 5 | matrix: 6 | ruby: ["2.5", "2.6", "2.7", "3.0"] 7 | runs-on: ubuntu-latest 8 | steps: 9 | - uses: actions/checkout@v2 10 | - run: echo $CR_PAT | docker login ghcr.io -u USERNAME --password-stdin 11 | env: 12 | CR_PAT: ${{ secrets.CR_PAT }} 13 | - uses: docker/build-push-action@v2 14 | with: 15 | context: ${{ matrix.ruby }}/ 16 | tags: ghcr.io/unasuke/distroless-ruby:${{ matrix.ruby }} 17 | push: true 18 | -------------------------------------------------------------------------------- /2.5/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ruby:2.5.8-stretch as ruby 2 | 3 | LABEL org.opencontainers.image.source=https://github.com/unasuke/distroless-ruby 4 | 5 | ADD https://github.com/coord-e/magicpak/releases/latest/download/magicpak-x86_64-unknown-linux-musl /usr/bin/magicpak 6 | RUN chmod +x /usr/bin/magicpak 7 | RUN /usr/bin/magicpak -v $(which ruby) /bundle 8 | 9 | FROM gcr.io/distroless/base-debian9 10 | 11 | COPY --from=ruby /bundle /. 12 | COPY --from=ruby /usr/lib/x86_64-linux-gnu/libyaml* /usr/lib/x86_64-linux-gnu/ 13 | COPY --from=ruby /usr/local/bin/ /usr/local/bin 14 | COPY --from=ruby /usr/local/include/ /usr/local/include 15 | COPY --from=ruby /usr/local/lib/ruby/ /usr/local/lib/ruby 16 | 17 | CMD ["/usr/local/bin/ruby", "-v"] 18 | -------------------------------------------------------------------------------- /2.6/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ruby:2.6.6-stretch as ruby 2 | 3 | LABEL org.opencontainers.image.source=https://github.com/unasuke/distroless-ruby 4 | 5 | ADD https://github.com/coord-e/magicpak/releases/latest/download/magicpak-x86_64-unknown-linux-musl /usr/bin/magicpak 6 | RUN chmod +x /usr/bin/magicpak 7 | RUN /usr/bin/magicpak -v $(which ruby) /bundle 8 | 9 | FROM gcr.io/distroless/base-debian9 10 | 11 | COPY --from=ruby /bundle /. 12 | COPY --from=ruby /usr/lib/x86_64-linux-gnu/libyaml* /usr/lib/x86_64-linux-gnu/ 13 | COPY --from=ruby /usr/local/bin/ /usr/local/bin 14 | COPY --from=ruby /usr/local/include/ /usr/local/include 15 | COPY --from=ruby /usr/local/lib/ruby/ /usr/local/lib/ruby 16 | 17 | CMD ["/usr/local/bin/ruby", "-v"] 18 | -------------------------------------------------------------------------------- /2.7/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ruby:2.7.0-buster as ruby 2 | 3 | LABEL org.opencontainers.image.source=https://github.com/unasuke/distroless-ruby 4 | 5 | ADD https://github.com/coord-e/magicpak/releases/latest/download/magicpak-x86_64-unknown-linux-musl /usr/bin/magicpak 6 | RUN chmod +x /usr/bin/magicpak 7 | RUN /usr/bin/magicpak -v $(which ruby) /bundle 8 | 9 | FROM gcr.io/distroless/base-debian10 10 | 11 | COPY --from=ruby /bundle /. 12 | COPY --from=ruby /usr/lib/x86_64-linux-gnu/libyaml* /usr/lib/x86_64-linux-gnu/ 13 | COPY --from=ruby /usr/local/bin/ /usr/local/bin 14 | COPY --from=ruby /usr/local/include/ /usr/local/include 15 | COPY --from=ruby /usr/local/lib/ruby/ /usr/local/lib/ruby 16 | 17 | CMD ["/usr/local/bin/ruby", "-v"] 18 | -------------------------------------------------------------------------------- /3.0/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ruby:3.0.0-buster as ruby 2 | 3 | LABEL org.opencontainers.image.source=https://github.com/unasuke/distroless-ruby 4 | 5 | ADD https://github.com/coord-e/magicpak/releases/latest/download/magicpak-x86_64-unknown-linux-musl /usr/bin/magicpak 6 | RUN chmod +x /usr/bin/magicpak 7 | RUN /usr/bin/magicpak -v $(which ruby) /bundle 8 | 9 | FROM gcr.io/distroless/base-debian10 10 | 11 | COPY --from=ruby /bundle /. 12 | COPY --from=ruby /usr/lib/x86_64-linux-gnu/libyaml* /usr/lib/x86_64-linux-gnu/ 13 | COPY --from=ruby /usr/local/bin/ /usr/local/bin 14 | COPY --from=ruby /usr/local/include/ /usr/local/include 15 | COPY --from=ruby /usr/local/lib/ruby/ /usr/local/lib/ruby 16 | 17 | CMD ["/usr/local/bin/ruby", "-v"] 18 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ruby:3.0.0-buster as ruby 2 | 3 | ADD https://github.com/coord-e/magicpak/releases/latest/download/magicpak-x86_64-unknown-linux-musl /usr/bin/magicpak 4 | RUN chmod +x /usr/bin/magicpak 5 | RUN /usr/bin/magicpak -v $(which ruby) /bundle 6 | 7 | FROM gcr.io/distroless/base-debian10 8 | 9 | COPY --from=ruby /bundle /. 10 | COPY --from=ruby /usr/lib/x86_64-linux-gnu/libyaml* /usr/lib/x86_64-linux-gnu/ 11 | COPY --from=ruby /usr/local/bin/ /usr/local/bin 12 | COPY --from=ruby /usr/local/lib/ruby/ /usr/local/lib/ruby 13 | 14 | CMD ["/usr/local/bin/ruby", "-v"] 15 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2019 Yusuke Nakamura 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # distroless-ruby 2 | 3 | ## :warning: non-active 4 | **This repository is outdated.** 5 | 6 | Please follow this repository. 7 | 8 | 9 | 10 | ## build and run 11 | 12 | ```shell 13 | $ docker build -t unasuke/distroless-ruby:3.0 . 14 | [+] Building 33.2s (15/15) FINISHED 15 | => [internal] load build definition from Dockerfile 0.0s 16 | => => transferring dockerfile: 560B 0.0s 17 | => [internal] load .dockerignore 0.0s 18 | => => transferring context: 2B 0.0s 19 | => [internal] load metadata for gcr.io/distroless/base-debian10:latest 0.7s 20 | => [internal] load metadata for docker.io/library/ruby:3.0.0-buster 1.8s 21 | => CACHED https://github.com/coord-e/magicpak/releases/latest/download/magicpak-x86_64-unknown-linux-musl 0.0s 22 | => CACHED [stage-1 1/5] FROM gcr.io/distroless/base-debian10@sha256:27896ffebd4e745d5a5455d375879c55e8c09084e02c5a2538dbcbbbc901559d 0.0s 23 | => [ruby 1/4] FROM docker.io/library/ruby:3.0.0-buster@sha256:9db9a5cc635c602d6f87945caea3ae27cdefebd5118ee425ab73119e71ba49d3 8.7s 24 | => => resolve docker.io/library/ruby:3.0.0-buster@sha256:9db9a5cc635c602d6f87945caea3ae27cdefebd5118ee425ab73119e71ba49d3 0.0s 25 | => => sha256:937782447ff61abe49fd83ca9e3bdea338c1ae1d53278b2f31eca18ab4366a1e 192.33MB / 192.33MB 0.3s 26 | => => sha256:9db9a5cc635c602d6f87945caea3ae27cdefebd5118ee425ab73119e71ba49d3 1.86kB / 1.86kB 0.0s 27 | => => sha256:9da3c233fc9a8df5381c98820a1d8ec404af0d9a58f3fe040242d13f9cc9f8b7 2.00kB / 2.00kB 0.0s 28 | => => sha256:cfd5ab991d3fa8aacf75c1927a8b7b86f55ee76d180adc8af9adc3f84977adc7 7.23kB / 7.23kB 0.0s 29 | => => sha256:d217a8ff1a8013f063f300eb0483eed56c11b6d9f756cd8a54cbbdab8004f58a 198B / 198B 0.5s 30 | => => sha256:9a55402e3c10408f6225fe0760e9125555c7e6b0f8e9ca4c9155c8c735a5dcfe 28.35MB / 28.35MB 1.9s 31 | => => sha256:1a4a19b9061bcefa8272e29b0959153841a114a5cb6c8125daa1881f04aef207 141B / 141B 1.0s 32 | => => extracting sha256:937782447ff61abe49fd83ca9e3bdea338c1ae1d53278b2f31eca18ab4366a1e 7.1s 33 | => => extracting sha256:d217a8ff1a8013f063f300eb0483eed56c11b6d9f756cd8a54cbbdab8004f58a 0.0s 34 | => => extracting sha256:9a55402e3c10408f6225fe0760e9125555c7e6b0f8e9ca4c9155c8c735a5dcfe 0.8s 35 | => => extracting sha256:1a4a19b9061bcefa8272e29b0959153841a114a5cb6c8125daa1881f04aef207 0.0s 36 | => [ruby 2/4] ADD https://github.com/coord-e/magicpak/releases/latest/download/magicpak-x86_64-unknown-linux-musl /usr/bin/magicpak 0.3s 37 | => [ruby 3/4] RUN chmod +x /usr/bin/magicpak 0.3s 38 | => [ruby 4/4] RUN /usr/bin/magicpak -v $(which ruby) /bundle 0.4s 39 | => [stage-1 2/5] COPY --from=ruby /bundle /. 0.1s 40 | => [stage-1 3/5] COPY --from=ruby /usr/lib/x86_64-linux-gnu/libyaml* /usr/lib/x86_64-linux-gnu/ 0.0s 41 | => [stage-1 4/5] COPY --from=ruby /usr/local/bin/ /usr/local/bin 0.1s 42 | => [stage-1 5/5] COPY --from=ruby /usr/local/lib/ruby/ /usr/local/lib/ruby 0.2s 43 | => exporting to image 0.4s 44 | => => exporting layers 0.3s 45 | => => writing image sha256:0674df1d60bb24b3cb6ca731387a5c4faa8b55dd9e5fd836c7e201123fffc68a 0.0s 46 | => => naming to docker.io/unasuke/distroless-ruby:3.0 0.0s 47 | 48 | $ docker run --rm unasuke/distroless-ruby:3.0 ruby -v 49 | ruby 3.0.0p0 (2020-12-25 revision 95aff21468) [x86_64-linux] 50 | 51 | $ docker run --rm unasuke/distroless-ruby:3.0 ruby -e "pp RUBY_PLATFORM" 52 | "x86_64-linux" 53 | ``` 54 | 55 | 56 | ## see also 57 | [GoogleContainerTools/distroless: 🥑 Language focused docker images, minus the operating system.](https://github.com/GoogleContainerTools/distroless) 58 | -------------------------------------------------------------------------------- /build.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | docker build -t distroless-ruby:2.5 -f 2.5/Dockerfile . 4 | docker build -t distroless-ruby:2.6 -f 2.6/Dockerfile . 5 | docker build -t distroless-ruby:2.7 -f 2.7/Dockerfile . 6 | docker build -t distroless-ruby:3.0 -f 3.0/Dockerfile . 7 | --------------------------------------------------------------------------------